我正在尝试将 echarts 与 vuejs 一起使用。我发现vue-echarts-v3是我的用例的完美解决方案。绘制完所有图表后,我注意到我的网络应用程序没有在 IE 中呈现语法错误(SCRIPT1002:语法错误)。我发现这个错误是由于我使用的 echart 库造成的。
在 npm 页面上给出了以下配置:对于 webpack 1.x:
{
test: /\.js$/,
loader: 'babel',
include: [
- path.join(prjRoot, 'src')
- path.join(prjRoot, 'src'),
- path.join(prjRoot, 'node_modules/vue-echarts-v3/src')
],
- exclude: /node_modules/
- exclude: /node_modules(?![\\/]vue-echarts-v3[\\/]src[\\/])/
},
对于 webpack 2.x+:
{
test: /\.js$/,
loader: 'babel-loader',
- include: [resolve('src'), resolve('test')]
- include: [resolve('src'), resolve('test'), resolve('node_modules/vue-echarts-v3/src')]
}
如何在 vue-config.js 中配置相同的内容?这些是我正在使用的软件包版本:
试试这个。
vue-echarts-v3 的文档没有通知它,但是你也必须在你的 webpack(或你正在使用的任何其他捆绑器)配置中添加 echarts。
{
test: /\.js$/,
loader: 'babel-loader',
include: [
resolve('src'),
resolve('test'),
resolve('node_modules/vue-echarts-v3/src'), // Their suggestion https://www.npmjs.com/package/vue-echarts-v3
resolve('node_modules/echarts/lib'), // Not suggested, but required as well
]
},
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句