iview introduces Times error on demand
These dependencies were not found:
* iview/dist/styles/iview.css in ./src/main.js
* iview/src/components/button in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/HelloWorld.vue
To install them, you can run: npm install --save iview/dist/styles/iview.css iview/src/components/button
main.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue"
import App from "./App"
import router from "./router"
import { Button } from "iview"
import "iview/dist/styles/iview.css"
Vue.config.productionTip = false
Vue.component("Button", Button)
/* eslint-disable no-new */
new Vue({
el: "-sharpapp",
router,
components: { App },
template: "<App/>"
})
.babelrc
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime", [
"import", {
"libraryName": "iview",
"libraryDirectory": "src/components"
}
]]
}
Hello.vue
<template>
<div class="hello">
<Button type="primary">Primary</Button>
</div>
</template>
- I introduced it in accordance with the latest official api, and the following plug-ins have introduced
npm install babel-plugin-import --save-dev
could you please see what the reason is? thank you ~