vue-echarts: Cannot assign to read only property 'exports' of object '#'

The type of this issue / Issue 类型

  • Feature request / 新特性需求
  • Bug report / Bug 报告

Not introduced by ECharts / 非 ECharts 本身问题

Problems about ECharts itself are not handled in this repo. / 本 repo 不负责处理 ECharts 本身的问题。

  • I’ve checked it’s not a problem of ECharts itself. / 我已检查过,这个问题非 ECharts 本身的问题。

Details / 详情

How are you importing Vue-ECharts? / 你是如何引入 Vue-ECharts 的?

  • Bundled version/打包版本 (import ECharts from 'vue-echarts')
  • The .vue component/.vue 组件 (import ECharts from 'vue-echarts/components/ECharts')

The version of Vue-ECharts you are using / Vue-ECharts 的版本

Reproduction link / 复现链接

For bug reports, please provide the steps to reproduce and if possible a minimal demo of the problem. Please paste the link to your CodeSandbox demo below:

对于 Bug 报告,请在下面提供复现的步骤,最好是最小化的能够重现问题的 demo。请在下方贴入在 CodeSandbox 上 demo 的链接:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 40 (9 by maintainers)

Commits related to this issue

Most upvoted comments

将babelrc中的modules: false去掉应该就可以了

我用的 vue-cli@3.11.0 和 vue-echarts@4.0.3

把 vue.config.js 的配置修改成这样可以正常运行。

// 旧配置
  transpileDependencies: [
    /\bvue-echarts\b/,
    /\bresize-detector\b/
  ]
// 新配置
  transpileDependencies: [
    /\bvue-echarts\/components\b/
    /\bresize-detector\b/
  ]

外层要有 lodash 的依赖~ 一般项目都有,没有的话,就自行添加这个依赖。

PS,其他项目比如 vuepress 也有类似问题,刚解决。看作者是否能从根源解决这个问题,谢谢~ https://github.com/vuejs/vuepress/issues/1807#issuecomment-528263887

旧项目升级需要以下操作后,重新build: rm package-lock.json rm -rf node_modules npm i

4.0.3 修改 babel 可以使用

// babel.config.js
module.exports = {
  presets: [
    '@vue/app',
  ],
  sourceType: 'unambiguous', // 添加这行
}

遇到相同的问题,根据上面的描述,分别安装了最新版本的vue-echarts和echarts,问题仍然存在。 目前凑合的解决方法是:移除vue-echarts和echarts,仅安装@3.1.3版的vue-echarts

这个问题现在仍然存在,根据上面兄弟给出的解决办法: 1、去掉webpack.base.conf.js文件中

include: [
          resolve('src'), 
          resolve('test'), resolve('node_modules/webpack-dev-server/client'),
      -   resolve('node_modules/vue-echarts'),
      -   resolve('node_modules/resize-detector')
        ]

后两行 2、.babelrc中,去掉

 "plugins": [
        "transform-vue-jsx", 
     -  "transform-runtime"
]

否则会一直报这个错误…还请大神给看看