在安装到主机应用程序时,加载Micro Frontend root App组件在单打序列中的CSS组件
同事!
需要一个建议! SinglesPareact中的Micro Frontend不会在安装上加载root的组件CSS,而只能根据路由导航页面CSS。
使用单打序列实现了微观前端。在WebPack.config中用于DevMode构建使用:
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
ignoreOrder: false,
}),
new ExposeRuntimeCssAssetsPlugin({
filename: '[name].[contenthash].css',
}),
],
我们使用CSS模块。 将我们的微型前端安装到主机应用程序时,已经遇到了问题:它不会加载root App组件的CSS。仅加载它通过路由导航到的页面。我们的切入点看起来像:
const lifecycles = singleSpaReact({
React,
ReactDOM,
rootComponent: App,
errorBoundary(err, info, props) {
return GlobalErrorBoundary
},
})
export const { bootstrap, mount, unmount } = lifecycles
因此,root React组件是应用程序。它在每个组件中呈现一个带有某些CSS模块的组件树,但是CSS并未加载。我检查了如何在主机应用中应用CSS:它通过路由在导航时将页面CSS的“链接”标签添加到头部。 在我们的构建中有什么问题,可能会添加哪些额外的步骤来解决问题,即使“应用” root组件的CSS加载? 非常感谢任何线索!
colleagues!
Need a piece of advice! Micro frontend in singleSpaReact does not load root's component CSS at the mounting, but only page CSS according routing navigation.
Implemented a micro frontend using singleSpaReact. In webpack.config for devmode build use:
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
ignoreOrder: false,
}),
new ExposeRuntimeCssAssetsPlugin({
filename: '[name].[contenthash].css',
}),
],
We use CSS-modules.
Have been running into an issue on mounting our micro front end to the host application: it does not load root App component's CSS. Only loads CSS for a page it navigates to via routing. Our entry point looks like:
const lifecycles = singleSpaReact({
React,
ReactDOM,
rootComponent: App,
errorBoundary(err, info, props) {
return GlobalErrorBoundary
},
})
export const { bootstrap, mount, unmount } = lifecycles
So, the root React component is App. It renders a tree of components with some CSS modules in each one, but the CSS is not loaded. I checked how the CSS is applied in our host app: it adds "link" tag for pages's CSS into the head on navigation via routing.
What's wrong in our build, what extra steps might be added to address the issue, I.e. to make "App" root component's CSS loaded?
Highly appreciate any clue!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经通过添加SinglesPacss模块解决了。
Already solved by means of adding singleSpaCss module.