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

perf(core): use prebundle to reduce dependencies #6462

Merged
merged 4 commits into from
May 7, 2024

Conversation

chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented May 7, 2024

Summary

Use prebundle to reduce dependencies of @rspack/core (12 deps -> 6 deps)

Screenshot 2024-05-07 at 14 16 11

How it works:

  • Use prebundle to bundle dependencies and output to the compiled folder.
  • Use tsc-alias to alias the import path to the compiled folder.

resolve #5097

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the release: performance release: performance related release(mr only) label May 7, 2024
Copy link

netlify bot commented May 7, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 5eb0742
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6639ed3b7e2e4300096fef66

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label May 7, 2024
@chenjiahan chenjiahan marked this pull request as draft May 7, 2024 08:25
@chenjiahan chenjiahan marked this pull request as ready for review May 7, 2024 09:31
@LingyuCoder LingyuCoder merged commit 3c07aa3 into main May 7, 2024
30 checks passed
@LingyuCoder LingyuCoder deleted the prebundle_deps_0507 branch May 7, 2024 09:55
@chenjiahan
Copy link
Member Author

!canary

@alfaproject
Copy link

How is this better? Now I have duplicate code in my node modules, ehhh

@chenjiahan
Copy link
Member Author

chenjiahan commented May 8, 2024

Bundle dependency is a very practical optimization method, and we can see that projects like Next.js and Vite have adopted it.

There are many benefits of bundle dependencies, including faster installation and prevention of supply chain attacks caused by updating indirect dependencies.

Regarding your concerns, while there may be duplicate code in node_modules, in most cases the code you need to download is less than before, because the bundling process removes unnecessary files.

@chenjiahan
Copy link
Member Author

According to my calculations, this PR has reduced the install size by 800kB, and we can further optimize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove Rspack deps to reduce Rspack install size
3 participants