使用Vue配置vue-echart-v3支持IE

Configure vue-echart-v3 with Vue for supporting IE

我正在尝试将 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
    ]
  },