1.打包运行vue项目,报错
Uncaught TypeError: Cannot assign to read only property ‘exports’ of object ‘#’
2.点开错误的文件,标注错误的地方是这样的一段代码:
3.同过谷歌查找,和论坛各种搜索:
原因如下: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的方式编写即可.
4.再次打包运行:
ok_