控制台定位到相应插件的js,找到插件:
1,在vue.config.js中配置:
'transpileDependencies': ['@jiaminghi/*',],
transpileDependencies为特别需要将es6代码翻译成es5的插件说明;
2,css3的var兼容:
npm install css-vars-ponyfill mutationobserver-shim —save
import 'mutationobserver-shim'
import cssVars from 'css-vars-ponyfill'
cssVars({
watch: true
})
3,乾坤兼容谷歌老版本,main.js中配置:(注意:子应用不能使用babel-polyfill)
npm install whatwg-fetch??custom-event-polyfill??core-js
import 'whatwg-fetch';
import 'custom-event-polyfill';
import 'core-js/stable/promise';
import 'core-js/stable/symbol';
import 'core-js/stable/string/starts-with';
import 'core-js/web/url';
4,qiankun兼容谷歌48版本,出现“
Application died in status LOADING_SOURCE_CODE: You need to export the functional lifecycles in xxx entry
”
解决: webpack?output.library ?配置成跟主应用中注册的?name ?字段一致,如:
// 主应用中注册子应用
registerMicroApps([
{
name: 'brokenSubApp',
entry: '//localhost:7100',
container: '#yourContainer',
activeRule: '/react',
},
]);
//将微应用的 output.library 改为跟主应用中注册的一致:
module.exports = {
output: {
// 这里改成跟主应用中注册的一致
library: 'brokenSubApp',
libraryTarget: 'umd',
jsonpFunction: `webpackJsonp_${packageName}`,
},
};
|