1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Cannot assign to read only property 'exports' of object '#Object'

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

时间:2021-12-23 21:10:20

相关推荐

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

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

ERROR in Error: E:\workdata\webpackVue/node_modules/_@babel_runtime@7.4.5@@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

[.]/[_@babel_runtime@7.4.5@@babel]/runtime/helpers/typeof.js?:33:16

- typeof.js?:34 eval

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

@babel/polyfill

npm install --save @babel/polyfill

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

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。