引入vux,v-chart 报错,错误信息如下:

ERROR Failed to compile with 1 errors 18:17:42

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)
| })

···回复:

vux2必须配合vux-loader使用, 请在build/webpack.base.conf.js里参照如下代码进行配置:

const vuxLoader = require('vux-loader')
const webpackConfig = originalConfig // 原来的 module.exports 代码赋值给变量 webpackConfig

module.exports = vuxLoader.merge(webpackConfig, {
  plugins: ['vux-ui']
})

具体参考:安装使用(webpack)


···回复:

这个错误是因为对象运算符没有被解析,需要安装对应插件来解析对应语法,transform-object-rest-spread,还得在.babelrc文件里面配置一下。

Scroll Up