打包时报错
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
原因
webpack 2中不允许混用import和module.exports
解决方法
安装插件
npm install --save-dev @babel/plugin-transform-modules-commonjs
增加配置 babel.config.js
{
plugins: ['@babel/plugin-transform-modules-commonjs']
}
参考
Cannot assign to read only property ‘exports’ of object 解决办法