Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'

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

點開錯誤的文件,標注錯誤的地方是這樣的一段代碼:

 

就是module.exports;

百度查不到,google一查果然有。

原因是:The code above is ok. You can mix require and export. You can‘t mix import and module.exports.

翻譯過來就是說,代碼沒毛病,在webpack打包的時候,可以在js文件中混用require和export。但是不能混用import 以及module.exports。

因為webpack 2中不允許混用import和module.exports,

1錯誤解決——解決辦法就是統一改成ES6的方式編寫即可.

 

最后運行成功。




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 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 '#' Cannot assign to read only property 'exports' of object '#' [one day one question] webpack 打包報錯 Cannot assign to read only property 'exports' of object '#' vue運行報錯error:Cannot assign to read only property 'exports' of object '#' 關於vue-cli3打包時遇到Cannot assign to read only property 'exports' of object '#'問題的解決方法。 Cannot assign to read only property 'className' of object '# ' vue-cli3 打包時使用‘babel-loader’遇到Cannot assign to read only property ‘exports’ of object '#'問題的解決方法。 Uncaught TypeError: Cannot read property 'addEventListener' of null
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM