[qiankun]Uncaught Error: application ‘vue2‘ died in status LOADING_SOURCE_CODE: [qiankun] You need t

enviroment

主应用 vue-cli搭建
微应用1 vue+webpack
微应用2 umi3

error

启动主应用控制台报错
Uncaught Error: application ‘vue2’ died in status LOADING_SOURCE_CODE: [qiankun] You need to export lifecycle functions in vue2 entry

reason

qiankun 抛出这个错误是因为无法从微应用的 entry js 中识别出其导出的生命周期钩子。

resolution

参考 官方FAQ第一个问题

https://qiankun.umijs.org/zh/faq

微应用1的解决办法

在vue入口文件添加生命周期的钩子
[qiankun]Uncaught Error: application ‘vue2‘ died in status LOADING_SOURCE_CODE: [qiankun] You need t_第1张图片

在webpack打包配置添加如下webpack配置
[qiankun]Uncaught Error: application ‘vue2‘ died in status LOADING_SOURCE_CODE: [qiankun] You need t_第2张图片

你可能感兴趣的:(pits,vue.js,javascript)