Cannot assign to read only property 'exports' of object '#<Object>'

Cannot assign to read only property 'exports' of object '#<Object>',第1张

概述在webpack项目中使用@babel/plugin-transform-runtime时,报错 ERROR in Error: E:\workdata\webpackVue/node_modules/[email protected][email protected]@@babel/runtime/helpers/ typeof.js?:33 module.exports = _typeof;

在webpack项目中使用@babel/plugin-transform-runtime时,报错

ERROR in Error: E:\workdata\webpackVue/node_modules/[email protected][email protected]@@babel/runtime/helpers/ typeof.Js?:33
module.exports = _typeof;
^
TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘
- typeof.Js?:33 Module.eval
[.]/[[email protected][email protected]@@babel]/runtime/helpers/typeof.Js?:33:16

- typeof.Js?:34 eval

在网上查了一下,貌似是因为项目中文件语法冲突,就是import和exports语法都有,找了几种解决方法都不行,后来安装了另一个babel包,就没报错了

@babel/polyfill

npm install --save @babel/polyfill

安装后不需要配置什么,重新启动项目就OK了

它类似一种打补丁,会把项目中需要转换语法的文件转换

总结

以上是内存溢出为你收集整理的Cannot assign to read only property 'exports' of object '#<Object>'全部内容,希望文章能够帮你解决Cannot assign to read only property 'exports' of object '#<Object>'所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1072927.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存