ts-loader v10.0.0-beta.0

v10.0.0-beta.0Pre-release
Added 1
  • Support for the TypeScript 7.1 API
Changed 9
  • ts-loader now compiles exclusively through TypeScript's native typescript/sync API, replacing the classic LanguageService, Program, and watch API integration
  • Minimum supported TypeScript version is now 7.1 (the 7.1 beta or later until a stable release), up from 3.6.3
  • Minimum supported Node.js version is now 22.x, up from 12.x
  • The compiler option must now resolve to a package exposing a <compiler>/sync entry point; drop-in classic-API compilers such as ttypescript are no longer supported
  • Info-level log messages are now written to stderr by default; set logInfoToStdOut to true to keep them on stdout
  • The errorFormatter colors argument is now a picocolors-backed helper object instead of a chalk instance, and chalk has been dropped as a runtime dependency
Removed 6
  • The compilerOptions loader option has been removed; set compiler options in tsconfig.json instead
  • The context loader option has been removed; relative paths always resolve against the config file's directory
  • The happyPackMode loader option has been removed
  • The experimentalFileCaching loader option has been removed
  • The experimentalWatchApi loader option has been removed
  • The onlyCompileBundledFiles loader option has been removed

From ts-loader

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 compiler option must now resolve to a package exposing a <compiler>/sync entry point (the TypeScript native API). Drop-in classic-API compilers (e.g. ttypescript) are no longer supported.
  • Removed the compilerOptions loader 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 in tsconfig.json instead.
  • Removed the context loader 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 happyPackMode loader option - HappyPack / thread-loader based parallelisation is no longer supported this way.
  • Removed the experimentalFileCaching loader option; there's no equivalent under the native API's own caching model.
  • Removed the experimentalWatchApi loader option, now that the native API supersedes TypeScript's classic watch API.
  • Removed the onlyCompileBundledFiles loader 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. Set logInfoToStdOut: true to keep them on stdout.
  • errorFormatter's colors argument is now a small picocolors-backed helper object instead of a chalk instance; chalk has been dropped as a runtime dependency in favour of picocolors.
Not supported yet
  • getCustomTransformers is 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.
  • resolveModuleName and resolveTypeReferenceDirective are still accepted for backwards compatibility but are now inert. Support for custom resolvers is available: https://github.com/microsoft/TypeScript/pull/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.json are followed by the native API. The projectReferences loader option is accepted but has no effect, and v10 doesn't build referenced projects to disk the way tsc --build does.
View original

Upgraded? How did it go?

Discussion