Cannot assign to read only property 'exports' of 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了

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 解决 Cannot assign to read only property 'exports' of object '#' 问题 Cannot assign to read only property 'exports' of object '#' Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' Cannot assign to read only property 'exports' of object 解决办法 Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' vue 项目启动报错:Cannot assign to read only property 'exports' of object '#' Cannot assign to read only property 'exports' of object '#' ,文件名大小写问题!!! Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#‘的解决方法
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM