-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
docs: describe null value for codeSplitting #12579
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
docs/docs/docs/api/config.md
Outdated
@@ -237,6 +237,8 @@ depPerChunk 和 bigVendors 类似,不同的是把依赖按 package name + vers | |||
|
|||
granularChunks 在 bigVendors 和 depPerChunk 之间取了中间值,同时又能在缓存效率上有更好的利用。无特殊场景,建议用 granularChunks 策略。 | |||
|
|||
不配置时为 `null`,表示**使用构建器的默认分包方案而不是不分包**,在 Webpack 和 Mako 下都是根据 `import()` 进行 chunk 拆分, 比如 `await import('./Foo.tsx')` 将会为 `Foo.tsx` 及其依赖生成独立的 chunk 文件,同时 entry 中已经存在的 module 会进行复用不会出现在拆分的 chunk 中。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用构建器的默认分包方案而不是不分包
好像不需要这样解释,难看懂。只需要解释 null 代表什么样的分包逻辑就好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者给 jsStrategy 加一个类型?默认值设为这个?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者给 jsStrategy 加一个类型?默认值设为这个?
不太行,会影响存量应用,这个策略配置是 Umi 4 发布一段时间以后才加的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
只需要解释 null 代表什么样的分包逻辑就好。
这样可以吗
不配置时为 `null`,表示**使用构建器的默认分包方案而不是不分包**,在 Webpack 和 Mako 下都是根据 `import()` 进行 chunk 拆分, 比如 `await import('./Foo.tsx')` 将会为 `Foo.tsx` 及其依赖生成独立的 chunk 文件,同时 entry 中已经存在的 module 会进行复用不会出现在拆分的 chunk 中。 | |
默认值为 `null`,表示遵循构建器的默认分包策略。在 Webpack 和 Mako 下都是根据 `import()` 进行 chunk 拆分, 比如 `await import('./Foo.tsx')` 将会为 `Foo.tsx` 及其依赖生成独立的 chunk 文件,同时 entry 中已经存在的 module 会进行复用不会出现在拆分的 chunk 中。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所以 umi 路由默认不拆分是么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我感觉需要一个路由默认拆分的配置项。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认也拆分的,因为 Umi 的路由组件都是 import()
加载的,所以可以理解为 Umi 应用默认是按路由拆分 chunk;codeSplitting
配置是在此基础上进一步拆分公共 chunk,我重新调整了下描述,先介绍 null
再说明其他策略,看看这样是否 OK
codeSplitting 配置项增加
null
值的描述,避免用户误以为是不分包