Skip to content

Commit

Permalink
feat(plugins): use app name as qiankun library name by default (#11530)
Browse files Browse the repository at this point in the history
* feat: 默认使用应用名作为 library 名

* chore: 临时 revert 验证 e2e

* chore: revert

* fix: e2e

* fix: e2e
  • Loading branch information
kuitos authored Aug 18, 2023
1 parent daec0c4 commit df2cb66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

1 comment on commit df2cb66

@vercel
Copy link

@vercel vercel bot commented on df2cb66 Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.