vue-cli4升级vue-cli5打包的时候遇到一个报错:

ERROR  Failed to compile with 2 errors

error  in ./node_modules/canvg/lib/index.es.js

export 'default' (imported as '_asyncToGenerator') was not found in '@babel/runtime/helpers/asyncToGenerator' (module has no exports)

error  in ./node_modules/canvg/lib/index.es.js

export 'default' (imported as '_defineProperty') was not found in '@babel/runtime/helpers/defineProperty' (module has no exports)

ERROR  Error: Build failed with errors.

解决方案:在vue.config.js 中配置 transpileDependencies


module.exports = {
  transpileDependencies: ['canvg']
}

原因:

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐