[one day one question] webpack 打包报错 Cannot assign to read only property 'exports' of object '#'

问题描述:

  webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>',这怎么破?

解决方案

  原因是: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,

  解决办法就是统一改成ES6的方式编写即可.

 

 

君生我未生,我生君已老 君恨我生迟,我恨君生早 
君生我未生,我生君已老 恨不生同时,日日与君好
我生君未生,君生我已老 我离君天涯,君隔我海角
我生君未生,君生我已老 化蝶去寻花,夜夜栖芳草


免责声明!

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



猜您在找 Cannot assign to read only property 'exports' of object '#' Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#‘的解决方法 vue运行报错error:Cannot assign to read only property 'exports' of object '#' Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 关于vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#'问题的解决方法。 Vue 使用自定义组件时报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' vue-cli3 打包时使用‘babel-loader’遇到Cannot assign to read only property ‘exports’ of object '#'问题的解决方法。 Cannot assign to read only property 'className' of object '#' 使用webpack命令打包时,报错TypeError: Cannot read property 'presetToOptions' of undefined的解决办法
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM