Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugins): use app name as qiankun library name by default #11530

Merged
merged 5 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/docs/docs/max/micro-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ qiankun: {

当您使用 antd 作为项目组件库时,可以向子应用传入 `autoCaptureError` 属性以开启子应用错误捕获能力,插件将会自动调用 antd 的 [`<Result />` 组件](https://ant.design/components/result-cn/)作为错误捕获组件。

如(文案语言会自动读取 umi locale 配置切换):<img src="https://mdn.alipayobjects.com/huamei_zvchwx/afts/img/A*gAAVRrAJJNEAAAAAAAAAAAAADuWEAQ/original">

如果通过路由的模式引入子应用,可以配置如下:

```ts
Expand Down
4 changes: 3 additions & 1 deletion packages/plugins/src/qiankun/slave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export interface IRuntimeConfig {

api.chainWebpack((config) => {
assert(api.pkg.name, 'You should have name in package.json.');
const { shouldNotAddLibraryChunkName } = (api.config.qiankun || {}).slave!;
// 默认不修改 library chunk 的 name,从而确保可以通过 window[appName] 访问到导出
// mfsu 关闭的时候才可以修改,否则可能导致配合 mfsu 时,子应用的 umd chunk 无法被正确加载
const { shouldNotAddLibraryChunkName = !Boolean(api.config.mfsu) } = (api.config.qiankun || {}).slave!;
config.output
.libraryTarget('umd')
.library(
Expand Down
Loading