fix: do not split root module for async chunks #929
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
不对 async chunk 的根模块做 Code Splitting,在拆分行为上和 Webpack 保持一致,举个例子说明 PR 前后的区别:
如果模块 a 同时被
await import
和被另一 async moduleimport
引入,在 PR 前是概率性被拆分为独立的 async chunk 或 common(默认的 splitGroup,提取 async chunk 的依赖),在 PR 后是稳定拆分为独立的 async chunk改动原因:实际业务中可能会出现页面组件之间相互引用的情况,不改的话就有可能出现页面组件被拆到 common 里的情况,和我们预期的按路由维度按需加载的行为不一致