vue 項目啟動報錯:Cannot assign to read only property 'exports' of object '#'

最近做項目,打開一個新項目,在啟動時報錯

查詢百度結果是

在webpack打包的時候,可以在js文件中混用require和export。但是不能混用import 以及module.exports。

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

但是在經過我試驗之后,發現不起作用,再去百度,發現一個解決辦法:

執行npm:

    npm install babel-plugin-transform-es2015-modules-commonjs

然后在 babelrc文件中配置

{ “plugins”: [“transform-es2015-modules-commonjs”] }

 

 

 問題解決啦,感謝百度!大佬一直在,就看你會不會找了~


免責聲明!

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



猜您在找 Vue的報錯:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' 解決 Cannot assign to read only property 'exports' of object '#' 問題 Cannot assign to read only property 'exports' of object 解決辦法 vue項目中引入 html2canvas ,控制台報錯 Cannot assign to read only property 'className' of object '#< SVGSVGElement >' sdk uncaught third Error Cannot assign to read only property 'constructor' of object '# ' (小程序) vue報錯:Cannot read property 'init' of undefined vue項目中使用echarts map報錯Cannot read property 'push' of undefined nanhai.js vue報錯TypeError: Cannot read property '$createElement' of undefined vue初始化報錯,Cannot read property '$createElement' of undefined vue 報錯解決:TypeError: Cannot read property '_t' of undefined"
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM