Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Obj 解决方案

最近项目在 打包时出现错误:
Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Obj 解决方案_第1张图片

issue传送门

造成这个的原因是因为:
导入导出模块使用的规范不同,commjs和ES6的导出导入冲突

解决方案
babel.config.js中增加sourceType选项
Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Obj 解决方案_第2张图片

module.exports = {
     
  presets: [
    '@vue/app'
  ],
  sourceType: 'unambiguous'
}

千里之行
始于足下

你可能感兴趣的:(Vue)