vux组件引用报错

我发现我每次引用vux组件时候都报错

 ERROR  Failed to compile with 1 errors                                                                                                                                                                          01:23:09
 error  in ./node_modules/_vux@2.9.1@vux/src/components/v-chart/mixin.js

Module parse failed: Unexpected token (18:6)
You may need an appropriate loader to handle this file type.
|     this.$parent.set(this.chartName, {
|       shape: defaultShapeMap[this.chartName] || '',
|       ...this.$props,
|       ...camelAttrs(this.$attrs)
|     })

 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/_vux@2.9.1@vux/src/components/v-chart/v-line.vue 2:0-27
 @ ./node_modules/_vux@2.9.1@vux/src/components/v-chart/v-line.vue
 @ ./node_modules/_vux@2.9.1@vux/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

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 MetaInfo from 'vue-meta-info'
import { Icon } from 'vux'

Vue.config.productionTip = false
Vue.use(MetaInfo)
Vue.component('icon', Icon)


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

不知道这到底是什么原因?
是不是vux的引入方式不正确导致?

阅读 6.5k
2 个回答

请在build/webpack.base.conf.js里参照如下代码进行配置
clipboard.png

先把题目改改大哥,vux不能直接这么用,看看文档
https://doc.vux.li/zh-CN/inst...
vux2必须配合vux-loader使用, 请在build/webpack.base.conf.js里参照如下代码进行配置: