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

fix: incorrect chunk size map #1161

Merged
merged 2 commits into from
May 15, 2024
Merged

fix: incorrect chunk size map #1161

merged 2 commits into from
May 15, 2024

Conversation

xusd320
Copy link
Contributor

@xusd320 xusd320 commented May 14, 2024

  1. 修复 optimize_chunk 阶段的 chunk_size_map 计算逻辑。之前对于所有不在 node_modules 下的文件,会全部计入到 “unknown” 的 chunk size 里去,导致计算 chunk 的 total_size 不准确;
  2. 添加 code-splitting.many-pages 用例,参考自 webpack/examples/many-pages 。该用例需将页面公共依赖分别拆分打进独立 chunk,在本 PR 之前,mako 无法通过配置实现同等效果。

Summary by CodeRabbit

  • 新功能
    • 在应用程序中添加了代码拆分功能。
  • 文档
    • 为多页面应用程序中的代码拆分配置文件mako.config.json添加了配置设置。
  • 页面更新
    • 更新了多页面应用程序中的各个页面文件,引入了不同的模块和共享文件。

@xusd320 xusd320 changed the title Fix/incorrect chunk size map fix: incorrect chunk size map May 14, 2024
Copy link
Contributor

coderabbitai bot commented May 14, 2024

漫游

这次变更集中在代码拆分和优化上,涉及到 mako crate 中 optimize_chunk.rs 文件的重构,以及多页面应用中的模块拆分和配置更新。文件间的依赖关系和拆分逻辑得到了调整,以提高构建结果的效率和可维护性。

变更

文件 摘要
mako/src/generate/optimize_chunk.rs 优化 Compiler 实现逻辑,调整 package_json() 方法返回值
code-splitting.many-pages/expect.js
code-splitting.many-pages/pages/a.js
code-splitting.many-pages/pages/b.js
引入模块导入和共享文件,验证拆分结果
code-splitting.many-pages/mako.config.json 多页面应用的代码拆分配置
node_modules/m*.js 新增 npm 模块文件,输出简单信息
stuff/s*.js 新增共享文件,输出模块信息

诗篇

共享模块相依连,构建结果显光辉。
优化代码拆分心,兔子欢舞情。 🐇📦

Note

Pull Request Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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.

@xusd320 xusd320 requested a review from stormslowly May 14, 2024 08:00
@sorrycc sorrycc merged commit fe9a1c9 into master May 15, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/incorrect-chunk-size-map branch May 15, 2024 00:57
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