Skip to content

fix: ~7% smaller bundle size by not packing unneeded yarnpkg/nm subdeps #8809

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

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Nov 25, 2024

Replace @yarnpkg/nm import with direct @yarnpkg/nm/hoist import and remove a large unused code subtree

Refs: yarnpkg/berry#6611

Two commits so that the first one can be tested individually if needed -- it produces no changes in the dist

Before: 9563553 bytes, after: 8920653 bytes for dist/pnpm.cjs

More reduction is possible (to ~7551098 bytes, ~21% total) by fixing other usused yarnpkg imports, but let's start with this one

@ChALkeR ChALkeR requested a review from zkochan as a code owner November 25, 2024 23:26
Copy link

welcome bot commented Nov 25, 2024

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@ChALkeR ChALkeR changed the title fix: 7% smaller bundle size fix: ~7% smaller bundle size Nov 25, 2024
@ChALkeR ChALkeR changed the title fix: ~7% smaller bundle size fix: ~7% smaller bundle size by not packing unneeded yarnpkg/nm subdeps Nov 25, 2024
@zkochan zkochan merged commit 2ae5eaf into pnpm:main Nov 26, 2024
8 of 9 checks passed
Copy link

welcome bot commented Nov 26, 2024

Congrats on merging your first pull request! 🎉🎉🎉

@ChALkeR
Copy link
Contributor Author

ChALkeR commented Nov 29, 2024

Should this be backported to v9?

@zkochan
Copy link
Member

zkochan commented Nov 29, 2024

Is it safe?

@ChALkeR
Copy link
Contributor Author

ChALkeR commented Nov 29, 2024

@zkochan

  1. tsconfig changes -- completely safe, it had zero effect on the generated bundle

  2. Import change / code removal -- should be completely safe, all other code was unused & was auto-removed by changing imports (and the method actually imported was not changed & is isolated from all that removed code)

  3. @yarnpkg/nm version bump 4.0.2 -> 4.0.5 -- unsure. That's a semver-patch release though?

    These two prs (and only them) touched the code used here:

zkochan pushed a commit that referenced this pull request Nov 30, 2024
…ps (#8809)

* chore: use node16 ts moduleResolution in real-hoist

* fix: 7% smaller bundle size
@ChALkeR
Copy link
Contributor Author

ChALkeR commented Mar 23, 2025

Follow-up in #8810

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