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