Skip to content

chore: migrate from yarn to npm - #1712

Merged
johnnyreilly merged 3 commits into
mainfrom
migrate-to-npm
Oct 16, 2026
Merged

johnnyreilly merged 3 commits into
mainfrom
migrate-to-npm

Conversation

@johnnyreilly

@johnnyreilly johnnyreilly commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves ts-loader's development tooling from yarn to npm. This is an alternative to #1711 (pnpm), for comparison.

  • Lockfile: yarn.lock is replaced by package-lock.json. It was generated by running npm install with the old yarn.lock present, so every resolved version matches yarn's.
  • Peer deps: yarn never enforced peer ranges, and npm rejects babel-loader@7's webpack@2 || 3 peer. That is fixed with "overrides": { "babel-loader": { "webpack": "$webpack" } }. legacy-peer-deps was tried first, but it hoisted ajv-keywords@5 next to eslint's ajv@6 and broke every webpack build.
  • Execution-test packs: all yarn.lock files are converted the same way, from empty node_modules. A script confirmed each package-lock.json resolves exactly the versions in its yarn.lock. The pnpm migration's pnpm import and npm's --package-lock-only both drifted.
    • run-tests.js installs packs with npm install --install-links --legacy-peer-deps. --install-links copies file: deps instead of symlinking them, which keeps the git-tracked copies in some packs' node_modules intact. The pnpm pack still installs with pnpm, as before.
  • testLib: the comparison tests' npm link ./test/comparison-tests/testLib is kept. It is now native to the package manager and leaves the lockfile unchanged (checked).
  • CI:
    • Workflows use cache: npm, npm ci, npm run …, and npm install -D … for the TS/webpack matrix. A dry run of both matrix installs resolves cleanly.
    • The benchmark job installs a base branch that predates package-lock.json with npx yarn@1, because npm can't install main as it stands (the babel-loader peer conflict).
  • Other files: the Dockerfile, devcontainer, .vscode/settings.json, AGENTS.md, CONTRIBUTING.md and the test-pack READMEs are updated.

Not changed: the README's install instructions for ts-loader users (including Yarn PnP), REFERENCES.md, examples/, CHANGELOG.md, and the yarn hint in src/compilerSetup.ts.

Testing

Run locally on macOS with Node 24 and npm 11:

  • npm run build and npm run lint pass.
  • npm run comparison-tests: 89/89 suites pass.
  • npm run execution-tests: 28/29 suites pass. 3.6.0_projectReferencesToBeBuilt also fails locally on main with yarn (karma temp-path issue on macOS), and it passes in CI.
  • The benchmark job's base-branch steps were simulated against main, and the benchmark ran end to end.

🤖 Generated with Claude Code

johnnyreilly and others added 2 commits October 16, 2026 09:08
- replace yarn.lock with package-lock.json, generated by `npm install`
  against the old yarn.lock so resolved versions are unchanged
- resolve babel-loader@7's stale webpack peer range with an override
  rather than legacy-peer-deps, which mis-hoists ajv-keywords
- convert execution-test pack lockfiles the same way (versions verified
  to match their yarn.lock) and install them with npm
- CI: cache npm, `npm ci`, `npm install -D` for the matrix
- update Dockerfile, devcontainer and docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Benchmark (Ubuntu)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 961.3 925.2 +3.9%
Incremental rebuild (leaf touch) false 62.0 60.8 +1.9%
Incremental rebuild (hub touch) false 370.7 364.4 +1.8%
Cold build true 566.4 576.5 -1.7%
Incremental rebuild (leaf touch) true 31.1 32.0 -2.8%
Incremental rebuild (hub touch) true 34.9 34.2 +1.8%

PR branch = /home/runner/work/ts-loader/ts-loader, base branch = /home/runner/work/ts-loader/ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Benchmark (macOS)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 1346.9 1321.0 +2.0%
Incremental rebuild (leaf touch) false 87.0 81.9 +6.2%
Incremental rebuild (hub touch) false 692.1 693.6 -0.2%
Cold build true 871.8 865.2 +0.8%
Incremental rebuild (leaf touch) true 59.5 56.6 +5.0%
Incremental rebuild (hub touch) true 54.4 57.0 -4.6%

PR branch = /Users/runner/work/ts-loader/ts-loader, base branch = /Users/runner/work/ts-loader/ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Benchmark (Windows)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 747.5 754.9 -1.0%
Incremental rebuild (leaf touch) false 53.5 53.3 +0.3%
Incremental rebuild (hub touch) false 305.5 303.3 +0.7%
Cold build true 518.0 526.9 -1.7%
Incremental rebuild (leaf touch) true 29.7 32.5 -8.6%
Incremental rebuild (hub touch) true 30.6 32.4 -5.6%

PR branch = C:\source\ts-loader, base branch = C:\source\ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

@johnnyreilly
johnnyreilly merged commit 7c94c5e into main Oct 16, 2026
55 checks passed
johnnyreilly added a commit that referenced this pull request Oct 16, 2026
Brings in the yarn → npm migration (#1712). Conflicts resolved by keeping
this branch's content and applying the same yarn → npm conversion:

- package-lock.json regenerated from this branch's yarn.lock (exact
  version match), not main's; same for the 4.7.0_5.0.0_node16-file-suffix
  pack, whose yarn.lock differs here
- drop main's new lockfiles for 2.8.1_option-context and basic-happypack,
  which this branch deletes
- convert the branch-only format/knip workflows, the re-enabled macOS
  execution job and the .claude permissions allowlist to npm

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
johnnyreilly added a commit that referenced this pull request Oct 21, 2026
Brings in the yarn → npm migration (#1712). Conflicts resolved by keeping
this branch's content and applying the same yarn → npm conversion:

- package-lock.json regenerated from this branch's yarn.lock (exact
  version match), not main's; same for the 4.7.0_5.0.0_node16-file-suffix
  pack, whose yarn.lock differs here
- drop main's new lockfiles for 2.8.1_option-context and basic-happypack,
  which this branch deletes
- convert the branch-only format/knip workflows, the re-enabled macOS
  execution job and the .claude permissions allowlist to npm

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant