-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Cannot assign to read only property 'exports' of object '#<Object>' #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
我检查这个问题说是webpack2不能再同时使用import和moudle.exports但是我看了下这个组件Echarts.vue并没有这个问题 |
你提供的信息和代码都不够完整,无法重现就无法定位问题。 |
直接在vuecli里面引入这个echarts组件,没有做其他处理,,报的错误就是Cannot assign to read only property 'exports' of object '#' |
需要可重现的步骤。vue cli 用的什么版本,什么模板,怎么引入的,啥都没有啊。 |
这样你的代码就不会过了babel-loader 了。 |
加上去报错的问题不知道怎么导致的 |
按你所说的步骤无法复现你的问题。你可以建一个 repo,构建一个可以复现的环境再来 reopen 吧。 PS. 建议以后在任何地方提 issue 都不要截图,请多为别人做一些考虑。 |
最新版仍有这个问题,在某些机器情况下出现(我这儿有个同事的windows出现这个错误),目前我直接编译源代码不会报错,应该是rollup编译的过程中某个参数导致的,还在探索中...... |
@Oscar-ren webpack/webpack#4039 是否是这个问题? |
嗯,我在参考这个,但还没找到问题所在 |
将babelrc中的modules: false去掉应该就可以了 |
这个问题现在仍然存在,根据上面兄弟给出的解决办法:
后两行
否则会一直报这个错误...还请大神给看看 |
去掉以后不会转译,只能在最新版浏览器 Chrome 里用,如果你能接受的话自然也是可以的…… webpack/webpack#4039 (comment) 这个 comment 看过了吗? |
您好: |
@Justineo 我建了一个 repo, https://github.com/lynzz/vue-echart4-demo, 可重现此问题 |
旧项目升级需要以下操作后,重新build: |
@hiwanz 可以了 |
去掉了"plugins": [ |
我的项目也这么报错,最后发现自己装的echarts版本和vue-echarts引用的echarts版本不一致导致的。 |
请问这个问题最终是怎么解决的? |
请问是怎么解决的 |
@skywalkers2012 你往上看一楼 |
楼上各位,如果问题是由于引入多个不同版本的 当然,更新到 4.x 的话记得 check 一下 CHANGELOG。 |
遇到相同的问题,根据上面的描述,分别安装了最新版本的vue-echarts和echarts,问题仍然存在。 |
This comment has been minimized.
This comment has been minimized.
@liwenda122 兄dei你这话说的太重了....开源项目免费给你用,用问题很正常,说出来大家讨论解决就好,没必要说这话......也没看出来这个issue有谁在教育别人..... |
This comment has been minimized.
This comment has been minimized.
这是一个已经解决的问题。升级到 v4 的一大原因就是要解决这个问题,如果你眼睛不好使我可以带你坐电梯:点我 ↑
请不要给别人设置义务,你没有这个权利,谢谢。 当然,你有权不接受教育,我也有权不再为你提供支持。不过污染环境的话就走好不送了。 |
This comment has been minimized.
This comment has been minimized.
@Justineo 经过测试,最新版本的v4.0.3依然存在这个问题。按照提供的方法无法解决,目前只能采用v3.0.3 conanliuhuan这位老兄提供的解决方法,亲测可用! |
4.0.3 修改 babel 可以使用 // babel.config.js
module.exports = {
presets: [
'@vue/app',
],
sourceType: 'unambiguous', // 添加这行
} |
你这个是vue-cli 3.0的 vue-cli 2.0怎么配置有没有什么建议 |
如果仍然有问题,请提供最小化的复现(可以新建一个 repo),不然我们无法提供帮助。 |
@Justineo 确定是 babel 版本问题。 将 babel 从 补充: |
我用的 [email protected] 和 [email protected] 把 vue.config.js 的配置修改成这样可以正常运行。 // 旧配置
transpileDependencies: [
/\bvue-echarts\b/,
/\bresize-detector\b/
] // 新配置
transpileDependencies: [
/\bvue-echarts\/components\b/
/\bresize-detector\b/
] 外层要有 lodash 的依赖~ 一般项目都有,没有的话,就自行添加这个依赖。 PS,其他项目比如 vuepress 也有类似问题,刚解决。看作者是否能从根源解决这个问题,谢谢~ |
The type of this issue / Issue 类型
Not introduced by ECharts / 非 ECharts 本身问题
Problems about ECharts itself are not handled in this repo. / 本 repo 不负责处理 ECharts 本身的问题。
Details / 详情
How are you importing Vue-ECharts? / 你是如何引入 Vue-ECharts 的?
import ECharts from 'vue-echarts'
).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 的链接:
The text was updated successfully, but these errors were encountered: