Skip to content

fix(deps): dedupe yarn.lock to shrink installed size @W-24460137@ - #693

Merged
rax-it merged 3 commits into
mainfrom
rv/dedupe-yarn-lock
Oct 12, 2026
Merged

rax-it merged 3 commits into
mainfrom
rv/dedupe-yarn-lock

Conversation

@rax-it

@rax-it rax-it commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

@W-24460137@

Problem

sf plugins install installs this JIT plugin from its npm-shrinkwrap.json. sf-prepack generates that shrinkwrap from the yarn node_modules layout, so yarn.lock duplicates ship to users.

yarn.lock had never been deduped. ^7.x @babel/* ranges were split across 7.28.5, 7.28.6 and 7.29.8, and yarn v1 nests a separate copy for each dependent that can't use the hoisted version. The result was 44 copies of @babel/types and 34 of @babel/parser.

Fix

  • Deduped yarn.lock with yarn-deduplicate, excluding typescript. typescript is excluded because deduping bumps the dev-only 5.5.4 to 5.9.3, which breaks type-checking.
  • Added yarn-deduplicate as a devDependency, with scripts yarn dedupe-lockfile (fix) and yarn dedupe-lockfile:check (CI guard in check-versions).
  • New dependabot-dedupe workflow dedupes yarn.lock on Dependabot PRs and pushes the fix back. It uses pull_request_target and runs only base-branch code.

Result

Installed size, with the shrinkwrap honored (as in sf plugins install):

Installed @babel/types copies
main (6.2.20) 678 MB 44
This PR 472 MB (−206 MB, −30%) 27

The remaining @babel duplication comes from exact pins in the LWC compilers and needs upstream changes.

Testing

  • yarn build and yarn test pass after a clean install.
  • Compile smoke test on API 66.0, 67.0 and 68.0 passes, with output byte-identical to main.
  • All CI checks pass, including NUTs.

🤖 Generated with Claude Code

rax-it and others added 2 commits October 9, 2026 10:51
Stale yarn.lock entries kept many ^7.x @babel ranges on older versions,
so yarn nested a separate copy per dependent and npm shrinkwrap
shipped that layout. Deduping cuts the installed plugin from 678 MB to
472 MB. CI now fails if yarn.lock has duplicates again.

typescript is excluded: dedupe bumps the dev-only 5.5.4 to 5.9.3,
which breaks type-checking of @inquirer/select imports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…24460137@

The previous yarn.lock was rewritten by npm during local packing
(npmjs URLs without hashes, invalid peer entries). Regenerated from
main with yarn-deduplicate.

yarn-deduplicate is now a devDependency so CI uses the locked version:
- yarn dedupe-lockfile: fix duplicates
- yarn dedupe-lockfile:check: CI guard

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rax-it
rax-it marked this pull request as ready for review October 9, 2026 20:03
@rax-it
rax-it requested review from a team as code owners October 9, 2026 20:03
Dependabot doesn't run yarn-deduplicate, so its PRs would fail
dedupe-lockfile:check. This workflow dedupes the PR's yarn.lock and
pushes it back with the bot token so CI reruns. It uses
pull_request_target and only runs tooling from the base checkout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rax-it
rax-it merged commit 46e2f32 into main Oct 12, 2026
23 checks passed
@rax-it
rax-it deleted the rv/dedupe-yarn-lock branch October 12, 2026 21:23
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