- Support TypeScript 7.1 API - thanks @johnnyreilly
This is a ground-up rewrite of ts-loader's compilation engine. Instead of driving TypeScript's classic LanguageService / Program / watch APIs, ts-loader now compiles exclusively through TypeScript's new native typescript/sync API (https://devblogs.microsoft.com/typescript/announcing-typescript-7-1-beta/#typescript-7.1-api) - the legacy compiler API integration has been removed entirely.
Breaking changes:
- Minimum supported TypeScript version is now 7.1+ (up from 3.6.3+). Until TypeScript 7.1 has a stable release, that means the 7.1 beta or later.
- Minimum supported Node.js version is now 22.x+ (up from 12.x+).
- The
compileroption must now resolve to a package exposing a<compiler>/syncentry point (the TypeScript native API). Drop-in classic-API compilers (e.g.ttypescript) are no longer supported. - Removed the
compilerOptionsloader option; the native API resolves a project's compiler options purely from its on-disk tsconfig.json, with no per-loader-instance override hook. Set compiler options intsconfig.jsoninstead. - Removed the
contextloader option; the native API always resolves relative paths against the config file's own directory, with no basePath override exposed to let a tsconfig live outside the project root. - Removed the
happyPackModeloader option - HappyPack / thread-loader based parallelisation is no longer supported this way. - Removed the
experimentalFileCachingloader option; there's no equivalent under the native API's own caching model. - Removed the
experimentalWatchApiloader option, now that the native API supersedes TypeScript's classic watch API. - Removed the
onlyCompileBundledFilesloader option; the native API always resolves a project's own root files and offers no hook to restrict them to what webpack actually bundles. - Info-level log messages are now written to stderr by default, as documented; previously they always went to stdout regardless of
logInfoToStdOut. SetlogInfoToStdOut: trueto keep them on stdout. errorFormatter'scolorsargument is now a smallpicocolors-backed helper object instead of achalkinstance;chalkhas been dropped as a runtime dependency in favour ofpicocolors.
Not supported yet
getCustomTransformersis still accepted for backwards compatibility but are now inert. The native API doesn't expose equivalent extension points for custom transformes. It is possible that the API will support these in future, and so the options have been left in place for now, but they will be removed if the API never exposes them.resolveModuleNameandresolveTypeReferenceDirectiveare still accepted for backwards compatibility but are now inert. Support for custom resolvers is available: microsoft/TypeScript#64299 - however it is not clear this is a feature generally used by ts-loader users and so has not been implemented at present.- Project references in
tsconfig.jsonare followed by the native API. TheprojectReferencesloader option is accepted but has no effect, and v10 doesn't build referenced projects to disk the waytsc --builddoes.