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

docs: describe null value for codeSplitting #12579

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Conversation

PeachScript
Copy link
Member

codeSplitting 配置项增加 null 值的描述,避免用户误以为是不分包

@PeachScript PeachScript requested a review from sorrycc July 17, 2024 04:19
Copy link

vercel bot commented Jul 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 9:16am

Copy link

coderabbitai bot commented Jul 17, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -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 中。
Copy link
Contributor

Choose a reason for hiding this comment

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

使用构建器的默认分包方案而不是不分包

好像不需要这样解释,难看懂。只需要解释 null 代表什么样的分包逻辑就好。

Copy link
Contributor

Choose a reason for hiding this comment

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

或者给 jsStrategy 加一个类型?默认值设为这个?

Copy link
Member Author

Choose a reason for hiding this comment

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

或者给 jsStrategy 加一个类型?默认值设为这个?

不太行,会影响存量应用,这个策略配置是 Umi 4 发布一段时间以后才加的

Copy link
Member Author

Choose a reason for hiding this comment

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

只需要解释 null 代表什么样的分包逻辑就好。

这样可以吗

Suggested change
不配置时为 `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 中。

Copy link
Contributor

Choose a reason for hiding this comment

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

所以 umi 路由默认不拆分是么?

Copy link
Contributor

Choose a reason for hiding this comment

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

我感觉需要一个路由默认拆分的配置项。

Copy link
Member Author

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

@PeachScript PeachScript merged commit ce4eff5 into master Jul 18, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants