Closed yyyyffqqqq closed 1 month ago
确认下被移除样式的特征,如果是因为主子应用有重复的样式文件导致,可以考虑通过以下 API 控制 https://micro-frontends.ice.work/docs/api/ice-stark/#shouldassetsremove
测试代码 ice3-antd5-dev.zip
确认下被移除样式的特征,如果是因为主子应用有重复的样式文件导致,可以考虑通过以下 API 控制 https://micro-frontends.ice.work/docs/api/ice-stark/#shouldassetsremove
更改这个属性没效果,这个是demo ice3-antd5-dev.zip
确认下被移除样式的特征,如果是因为主子应用有重复的样式文件导致,可以考虑通过以下 API 控制 https://micro-frontends.ice.work/docs/api/ice-stark/#shouldassetsremove
这样配置shouldAssetsRemove就正常了,但是shouldAssetsRemove不管返回false还是true,结果都正常了,不知道原因是什么。之前找不到shouldAssetsRemove在哪里配置
export const icestark = defineFrameworkConfig(() => ({
// 用于微应用全局的 Layout
layout: FrameworkLayout,
// 配置微应用信息,可为异步方法
getApps: () => ([{
// path: '/test/micro1',
activePath: '/test/micro1',
title: '商家平台',
sandbox: true,
container: document?.getElementById('sub-app-layout') || undefined,
cached: false,
// Important!!
// Use loadScriptMode: 'fetch' to load child app source code when child app is not build by vite.
// Visit https://micro-frontends.ice.work/docs/api/ice-stark/#loadscriptmode- to get more details.
loadScriptMode: 'import',
prefetch: true,
scriptAttributes: ['crossorigin=anonymous'],
entry: 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/icestark/child-seller-ice-vite/index.html',
},
{
activePath: '/test/angular',
title: 'Angular',
sandbox: true,
cached: false,
prefetch: true,
scriptAttributes: ['crossorigin=anonymous'],
// Angular app demo: https://github.com/ice-lab/icestark-child-apps/tree/master/child-common-angular
entry: 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/icestark/child-common-angular/index.html',
},
]),
// icestark 提供的 AppRouter 组件的配置参数
appRouter: {
basename: `${process.env.ICE_PUBLIC_PATH}`,
shouldAssetsRemove: (assetUrl?: string, element?: HTMLElement | HTMLLinkElement | HTMLStyleElement | HTMLScriptElement) => {
console.log('assetUrl: ', assetUrl);
return false;
},
LoadingComponent: PageLoading,
NotFoundComponent: () => {
return <div>404</div>;
},
},
}));
Describe the bug
ice3.0 主应用切换到微应用,从微应用切回主应用,样式失效
Expected behavior
样式正常
Actual behavior
No response
Version of ice.js
"@ice/app": "3.4.7"
Content of build.json or ice.config.mts
Additional context
No response