xlsdg / vue-echarts-v3

Vue.js(v2.x+) component wrap for ECharts.js(v3.x+)
https://xlsdg.github.io/vue-echarts-v3-demo/
MIT License
904 stars 124 forks source link

'npm run build' get error 'Unexpected token: punc()' vue-echarts-v3/src/wrapper.js:44,0 #68

Closed HarryPoint closed 6 years ago

HarryPoint commented 6 years ago

ERROR in static/js/xxxxxxx.js from UglifyJs Unexpected token: punc()' vue-echarts-v3/src/wrapper.js:44,0

xlsdg commented 6 years ago

webpack config add:

{
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-echarts-v3/src')]
}
caorushizi commented 6 years ago

加上了还是打包不了

HarryPoint commented 6 years ago
import IEcharts from 'vue-echarts-v3'

还是通用这种方式引用打包完成的文件比较合理(现目前可用,但是不支持按需加载)。 既然写成npm 包 ,建议提供对应的编译后的文件(dist目录下),这样使用的时候不用改变开发者的开发配置。

xlsdg commented 6 years ago

参考一下 Demo 的例子,两种方式都是可以使用的。

xlsdg commented 6 years ago

@zain-dio 刚刚路径后面漏了加 src

caorushizi commented 6 years ago

@xlsdg 1

zengjingke commented 6 years ago

我的也会出现这样的问题,配置也都是复制粘贴,还是一直报错

xlsdg commented 6 years ago

@zengjingke 参考一下 Demo 的例子配置。

wasdokij commented 6 years ago

cted token: punc ()) [./node_modules/_vue-echarts-v3@1.0.15@vue-echarts-v3/src/wrapper.js:44,0][static/js/vendor.e00149c8807bee91a302.js:32888,18]

Build failed with errors.

目前按需加载 build 时会报错 ,配置文件 { test: /.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test'), resolve('node_modules/vue-echarts-v3/src')] },