Repository navigation
feat: lower minimum Node.js to 16.20, matching TypeScript 7.1 - #1723
Closed
johnnyreilly wants to merge 1 commit into
Closed
johnnyreilly wants to merge 1 commit into
johnnyreilly wants to merge 1 commit into
Conversation
TypeScript 7.1 is ESM-only and needs Node >=16.20. ts-loader loaded it with require(), which only works on Node versions with require(esm) support, so it now loads `<compiler>/sync` and `<compiler>/fs` with import() instead (once per compiler package, awaited at the top of the already-async loader). The comparison/execution harnesses can't run on Node 16, so a new framework-free smoke test (test/minimum-node-tests) runs in CI on Node 16.20.0 after installing and building on Node 26. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benchmark (Ubuntu)
PR branch = |
Benchmark (macOS)
PR branch = |
Benchmark (Windows)
PR branch = |
Member
Author
|
Better approach attempted here: #1725 But not viable anymore since: microsoft/TypeScript#64174 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1721
Summary
Lowers
engines.nodefrom>=22.0.0to>=16.20.0, the same minimum as TypeScript 7.1.Changing
enginesalone would not have been enough. TypeScript 7.1 is ESM-only ("type": "module"), and ts-loader loaded it withrequire(). That only works on Node versions withrequire(esm)(20.19+ / 22.12+). On Node 16, ts-loader failed at load time withERR_REQUIRE_ESM.Changes
src/typeScriptApi.ts:<compiler>/syncand<compiler>/fsare now loaded withimport(), cached per compiler package. Paths are resolved withrequire.resolvefirst, so thecompileroption resolves the same way as before, including Windows absolute paths.createFileSystemLayernow also comes from the configuredcompilerpackage; before, it was always imported fromtypescript.src/index.ts:loaderalready usedthis.async(). It is now anasync functionthat awaits the (cached) TypeScript load before running the existing synchronous logic. Error stack traces keep the sameat successLoader/at Object.loaderframes, and all comparison snapshots pass unchanged.test/minimum-node-tests/: a new smoke test with no test framework. It builds a clean project, runs the bundle, and checks that a type error (TS2345) is reported. The comparison/execution harnesses can't run on Node 16: Jasmine 7 needsstructuredClone, and the comparison harnessrequirestypescript/sync..github/workflows/minimum-node-tests.yml(wired intoci.yml): installs and builds on Node 26, then runs the smoke test on Node 16.20.0.Testing
npm run lint,npm run knipand prettier all passnpm run comparison-testsandnpm run execution-testspass on Node 26npm run minimum-node-testspasses on Node 16.20.2 and Node 26. Onnextwithout this change, it fails on Node 16 withERR_REQUIRE_ESM.🤖 Generated with Claude Code