You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I saw it was released but I haven't experimented with it. Please do have a try and report back!
However, please note that the expectation is that transpileOnly: true is likely to work but that transpileOnly: false (type checking mode) is unlikely to work, and not expected to in future either.
ERROR in ./src/service/index.ts
Module build failed (from ./node_modules/ts-loader/index.js):
TypeError: Cannot read properties of undefined (reading 'fileExists')
at findConfigFile (C:\build\src\error-chrome-host\node_modules\ts-loader\dist\config.js:92:29)
at getConfigFile (C:\build\src\error-chrome-host\node_modules\ts-loader\dist\config.js:43:28)
at successfulTypeScriptInstance (C:\build\src\error-chrome-host\node_modules\ts-loader\dist\instances.js:117:58)
at getTypeScriptInstance (C:\build\src\error-chrome-host\node_modules\ts-loader\dist\instances.js:86:12)
at Object.loader (C:\build\src\error-chrome-host\node_modules\ts-loader\dist\index.js:59:67)
I'm pretty sure that all of what we need isn't there yet to migrate ts-loader to ts7 yet. I threw Claude at the problem and it came up with this view:
TypeScript 7 / tsgo (native preview) — where ts-loader stands
TypeScript 7.0 is the Go-native rewrite of the compiler (package @typescript/native-preview, binary tsgo). It's dramatically faster than the classic JS compiler, so it's natural to ask when/how ts-loader can move onto it. This doc captures the current state of that investigation so it doesn't need re-deriving each time it comes up.
The short version
There's currently no API for ts-loader to migrate onto. @typescript/native-preview is CLI-only — it does not export createProgram, createLanguageService, transpileModule, or anything else ts-loader calls. The TypeScript team has said a programmatic API is planned for TypeScript 7.1+, with no committed date, and that they're still in early design on it (there's an
internal libsyncrpc sync-IPC layer, not a public API).
Practically, this means: if a project's typescript dependency resolves to @typescript/native-preview, ts-loader breaks today with a cryptic TypeError: ts.createProgram is not a function (or the equivalent for transpileModule in transpileOnly mode) — this exact failure has already been reported against ts-loader in third-party TS7 compatibility testing.
Why full type-checking mode (transpileOnly: false) can't migrate yet
ts-loader's default mode is built on API surface that has no native-preview equivalent at all:
createWatchProgram and builder programs — src/instances.ts:394-415, src/servicesHost.ts:554-613
createSolutionBuilderWithWatch for project references — src/instances.ts:543-596, src/servicesHost.ts:765-914
Custom transformers threaded through emit — src/instances.ts:442-478, 784-838
Assorted private/internal APIs already guarded with as any — src/instances.ts:609-704
None of this is on native-preview's near-term roadmap. There's no narrow slice of it that can be ported piecemeal the way, say, ts-blank-space did in bloomberg/ts-blank-space#69 — that migration only needed to parse source into an AST and blank out type annotations, with no type-checking, no Program, and no watch/incremental state. Even that narrow surface hit real bugs along the way (AST start/end position drift, and UTF-8(Go)/UTF-16(JS) string offset mismatches) before landing a net perf win. ts-loader's full-checking mode has no comparably narrow surface to aim at.
Why transpileOnly: true is the only currently-relevant path
transpileOnly: true only calls compiler.transpileModule() (src/index.ts:657) — no Program or LanguageService involved. That's structurally the closest thing ts-loader has to what ts-blank-space needed. But transpileModule isn't exported by native-preview either, so this isn't an in-process API swap today — it's the existing decoupled pattern ts-loader already supports: transpile fast in-process (via the classic typescript package), and check for real types in a separate process.
ts-loader already documents exactly this split for speed reasons (see the transpileOnly section and the fork-ts-checker-webpack-plugin example). For TypeScript 7 adopters, the same shape applies: transpileOnly: true in ts-loader, and tsgo --noEmit (directly, or once fork-ts-checker-webpack-plugin grows tsgo support) as the type-checking step. See examples/typescript-7-tsgo for a working demonstration of this pairing.
Revisiting this
Re-evaluate once TypeScript 7.1 ships a real programmatic API. At that point the open questions are: does it expose anything Program/LanguageService-shaped, or only a parser/transpile surface; and does it support custom transformers and incremental/watch builds, which ts-loader also depends on for its default mode.
For anyone who needs webpack + ts-loader working on TypeScript 7 today, while a native-API migration is pending: Microsoft's side-by-side setup from the TypeScript 7.0 announcement works with the current ts-loader, no changes to webpack.config needed.
tsc resolves to the Go compiler, while require('typescript') — which is what ts-loader calls — gets the 6.x API from the compat package.
Tested on Windows 11, Node 24.14.0, webpack 5.111.1, ts-loader 9.6.2, same project, only the typescript entries changed:
Setup
npx tsc --version
npx webpack
typescript@6.0.3
6.0.3
compiled successfully
typescript@7.0.2
7.0.2
TypeError: Cannot read properties of undefined (reading 'fileExists') at successfulTypeScriptInstance (dist/instances.js:117:58)
side-by-side (above)
7.0.2
compiled successfully
The crash on plain 7 is because the package only exports ['version', 'versionMajorMinor'], so ts.sys is undefined when ts-loader reads the tsconfig.
One trap worth knowing: --legacy-peer-deps (the usual answer to the ERESOLVE you get elsewhere in a TS 7 project) skips installing all peer deps, not just the conflicting one — in the same test it silently dropped Vite from under Vitest. The side-by-side setup installs cleanly without it.
Activity
johnnyreilly commentedon May 23, 2025
I saw it was released but I haven't experimented with it. Please do have a try and report back!
However, please note that the expectation is that
transpileOnly: trueis likely to work but thattranspileOnly: false(type checking mode) is unlikely to work, and not expected to in future either.Read this for more detail: https://johnnyreilly.com/typescript-go-pragmatic-choice#ecosystem-tools
tmm1 commentedon Jul 22, 2025
tsgo is currently very good at typechecking, but the emit paths are wip so it cannot produce valid JS for a lot of cases
errorx666 commentedon Apr 27, 2026
This is now in beta, so I expect renewed interest in this.
johnnyreilly commentedon Apr 27, 2026
As I understand it, there's no API available yet. I think the API is scheduled to ship with 7.1 - @acutmore that's right I think?
acutmore commentedon Apr 27, 2026
That's correct. 7.0 only has the CLI.
An importable API is scheduled for 7.1.
As there are no new syntax features in 7.0 the existing
ts-loaderwill still be compatible with 7.0 code.danielweck commentedon Apr 30, 2026
Also see: TypeStrong/fork-ts-checker-webpack-plugin#892
errorx666 commentedon Jul 10, 2026
https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/
The line from the stack trace:
johnnyreilly commentedon Jul 10, 2026
I'm pretty sure that all of what we need isn't there yet to migrate
ts-loaderto ts7 yet. I threw Claude at the problem and it came up with this view:TypeScript 7 / tsgo (native preview) — where ts-loader stands
TypeScript 7.0 is the Go-native rewrite of the compiler (package
@typescript/native-preview, binarytsgo). It's dramatically faster than the classic JS compiler, so it's natural to ask when/howts-loadercan move onto it. This doc captures the current state of that investigation so it doesn't need re-deriving each time it comes up.The short version
There's currently no API for
ts-loaderto migrate onto.@typescript/native-previewis CLI-only — it does not exportcreateProgram,createLanguageService,transpileModule, or anything elsets-loadercalls. The TypeScript team has said a programmatic API is planned for TypeScript 7.1+, with no committed date, and that they're still in early design on it (there's aninternal
libsyncrpcsync-IPC layer, not a public API).Practically, this means: if a project's
typescriptdependency resolves to@typescript/native-preview,ts-loaderbreaks today with a crypticTypeError: ts.createProgram is not a function(or the equivalent fortranspileModuleintranspileOnlymode) — this exact failure has already been reported againstts-loaderin third-party TS7 compatibility testing.Why full type-checking mode (
transpileOnly: false) can't migrate yetts-loader's default mode is built on API surface that has no native-preview equivalent at all:createLanguageService/createDocumentRegistry—src/instances.ts:424-426createWatchProgramand builder programs —src/instances.ts:394-415,src/servicesHost.ts:554-613createSolutionBuilderWithWatchfor project references —src/instances.ts:543-596,src/servicesHost.ts:765-914src/instances.ts:442-478, 784-838as any—src/instances.ts:609-704None of this is on native-preview's near-term roadmap. There's no narrow slice of it that can be ported piecemeal the way, say, ts-blank-space did in bloomberg/ts-blank-space#69 — that migration only needed to parse source into an AST and blank out type annotations, with no type-checking, no
Program, and no watch/incremental state. Even that narrow surface hit real bugs along the way (AST start/end position drift, and UTF-8(Go)/UTF-16(JS) string offset mismatches) before landing a net perf win.ts-loader's full-checking mode has no comparably narrow surface to aim at.Why
transpileOnly: trueis the only currently-relevant pathtranspileOnly: trueonly callscompiler.transpileModule()(src/index.ts:657) — noProgramorLanguageServiceinvolved. That's structurally the closest thingts-loaderhas to what ts-blank-space needed. ButtranspileModuleisn't exported by native-preview either, so this isn't an in-process API swap today — it's the existing decoupled patternts-loaderalready supports: transpile fast in-process (via the classictypescriptpackage), and check for real types in a separate process.ts-loaderalready documents exactly this split for speed reasons (see thetranspileOnlysection and the fork-ts-checker-webpack-plugin example). For TypeScript 7 adopters, the same shape applies:transpileOnly: trueints-loader, andtsgo --noEmit(directly, or oncefork-ts-checker-webpack-plugingrows tsgo support) as the type-checking step. Seeexamples/typescript-7-tsgofor a working demonstration of this pairing.Revisiting this
Re-evaluate once TypeScript 7.1 ships a real programmatic API. At that point the open questions are: does it expose anything Program/LanguageService-shaped, or only a parser/transpile surface; and does it support custom transformers and incremental/watch builds, which
ts-loaderalso depends on for its default mode.See also: https://thinkingthroughcode.medium.com/i-tested-15-popular-libaries-with-typescript-7-toolchain-heres-how-to-fix-broken-migration-7ea719018e6d
Emit API has landed: microsoft/typescript-go#4699
Available in: TypeScript version 7.1.0-dev.20260725.1 and greater
johnnyreilly commentedon Jul 25, 2026
Not tested in any way as yet, but copilot has come up with this: #1703And because that was very verbose I asked it to implement a version without backwards compatibility:
#1704
Also not tested yetThis shows promise. Execution tests are passing and some comparison tests are passing.
nils44344 commentedon Sep 23, 2026
For anyone who needs webpack + ts-loader working on TypeScript 7 today, while a native-API migration is pending: Microsoft's side-by-side setup from the TypeScript 7.0 announcement works with the current ts-loader, no changes to
webpack.configneeded.tscresolves to the Go compiler, whilerequire('typescript')— which is what ts-loader calls — gets the 6.x API from the compat package.Tested on Windows 11, Node 24.14.0, webpack 5.111.1, ts-loader 9.6.2, same project, only the
typescriptentries changed:npx tsc --versionnpx webpacktypescript@6.0.3typescript@7.0.2TypeError: Cannot read properties of undefined (reading 'fileExists')atsuccessfulTypeScriptInstance (dist/instances.js:117:58)The crash on plain 7 is because the package only exports
['version', 'versionMajorMinor'], sots.sysis undefined when ts-loader reads the tsconfig.One trap worth knowing:
--legacy-peer-deps(the usual answer to theERESOLVEyou get elsewhere in a TS 7 project) skips installing all peer deps, not just the conflicting one — in the same test it silently dropped Vite from under Vitest. The side-by-side setup installs cleanly without it.Runnable reproduction: https://github.com/nils44344/node-ts-error-repros/tree/master/05-typescript-7-side-by-side
Bump ralphchives and discord-hitl dependencies to latest