Upgrading ts-loader 8 to 9
Breaking8.4.0 → 9.6.2Breaking3New7Changed4Fixed15Other6
BreakingUpgrade verdict
3 breaking changes.
In plain terms
- Remove usage of loader-utils -.
- minimum webpack version: 5.
- minimum node version: 12.
Must act 3 items need code or config changes
Node.js requirement changed in 9.0.0: >=10.0.0 → >=12.0.0.
Adds picomatch ^4.0.0, source-map ^0.7.4.
Drops enhanced-resolve, loader-utils, micromatch, semver.
Installs 8 packages in all (was 31).
What you must change
Breaking3
Remove usage of loader-utils -.
minimum webpack version: 5.
minimum node version: 12.
API changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- changed:
function makeAfterCompile(instance: TSInstance, configFilePath: string | undefined): (compilation: webpack.compilation.Compilation, callback: () => void) => void → function makeAfterCompile(instance: TSInstance, configFilePath: string | undefined): (compilation: webpack.Compilation, callback: () => void) => void
- changed:
function getCompilerOptions(configParseResult: typescript.ParsedCommandLine, compiler: typeof typescript): typescript.CompilerOptions → function getCompilerOptions(configParseResult: typescript.ParsedCommandLine, compiler: typeof typescript): { skipLibCheck: boolean } & typescript.CompilerOptions
- changed:
function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: webpack.loader.LoaderContext, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): { configFilePath: string | undefined; configFile: ConfigFile; configFileError: WebpackError | undefined } → function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: webpack.LoaderContext<LoaderOptions>, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): { configFilePath: string | undefined; configFile: ConfigFile; configFileError: webpack.WebpackError | undefined }
- added:
const declarationRegex: RegExp
- changed:
function loader(this: webpack.loader.LoaderContext, contents: string): void → function loader(this: webpack.LoaderContext<LoaderOptions>, contents: string, inputSourceMap?: Record<string, any>): void
- changed:
function setTSInstanceInCache(key: webpack.Compiler, name: string, instance: TSInstance): void → function setTSInstanceInCache(key: webpack.Compiler | undefined, name: string, instance: TSInstance): void
- changed:
function buildSolutionReferences(instance: TSInstance, loader: webpack.loader.LoaderContext): void → function buildSolutionReferences(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): void - changed:
function getTypeScriptInstance(loaderOptions: LoaderOptions, loader: webpack.loader.LoaderContext): { instance?: TSInstance; error?: WebpackError } → function getTypeScriptInstance(loaderOptions: LoaderOptions, loader: webpack.LoaderContext<LoaderOptions>): { instance?: TSInstance; error?: webpack.WebpackError } - changed:
function initializeInstance(loader: webpack.loader.LoaderContext, instance: TSInstance): void → function initializeInstance(loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance): void - changed:
function reportTranspileErrors(instance: TSInstance, loader: webpack.loader.LoaderContext): void → function reportTranspileErrors(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): void - added:
function getCustomTransformers(loaderOptions: LoaderOptions, program: typescript.Program | undefined, getProgram: (() => typescript.Program | undefined) | undefined): any
- removed:
interface WebpackError - removed:
interface WebpackModule - removed:
method WebpackModule.addError(error: WebpackError | Error): void - removed:
method WebpackModule.addWarning(warning: Error): void - removed:
method WebpackModule.clearWarningsAndErrors(): void - removed:
method WebpackModule.getErrors(): Iterable<WebpackError | Error> | undefined - removed:
method WebpackModule.getWarnings(): Iterable<Error> | undefined - removed:
property WebpackError.file?: string - removed:
property WebpackError.loaderSource: string - removed:
property WebpackError.loc?: { start: WebpackSourcePosition; end?: WebpackSourcePosition } - removed:
property WebpackError.location?: FileLocation - removed:
property WebpackError.message: string - removed:
property WebpackError.module?: any - removed:
property WebpackModule.buildMeta: { tsLoaderFileVersion: number; tsLoaderDefinitionFileVersions: string[] } - removed:
property WebpackModule.errors: WebpackError[] - removed:
property WebpackModule.resource: string - removed:
type ResolveSync = (context: string | undefined, path: string, moduleName: string) => string - removed:
type WebpackSourcePosition = { line: number; column?: number } - changed:
property LoaderOptions.getCustomTransformers: string | ((program: typescript.Program) => typescript.CustomTransformers | undefined) → property LoaderOptions.getCustomTransformers: string | ((program: typescript.Program, getProgram: () => typescript.Program) => typescript.CustomTransformers | undefined)
- added:
const isWebpack5: boolean - added:
function addErrorToModule(module: webpack.Module, error: webpack.WebpackError): void - added:
function getOptions(loaderContext: webpack.LoaderContext<LoaderOptions>): LoaderOptions
- changed:
function makeResolver(options: webpack.Configuration): ResolveSync → function makeResolver(_options: webpack.WebpackOptionsNormalized): ResolveSync - added:
type ResolveSync = { (context: any, path: string, moduleName: string): string | false; (path: string, moduleName: string): string | false }
- changed:
function getSolutionErrors(instance: TSInstance, context: string): WebpackError[] → function getSolutionErrors(instance: TSInstance, context: string): webpack.WebpackError[] - changed:
function makeServicesHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): ServiceHostWhichMayBeCacheable → function makeServicesHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): ServiceHostWhichMayBeCacheable - changed:
function makeSolutionBuilderHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance): SolutionBuilderWithWatchHost → function makeSolutionBuilderHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance): SolutionBuilderWithWatchHost - changed:
function makeWatchHost(scriptRegex: RegExp, loader: webpack.loader.LoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): WatchHost → function makeWatchHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): WatchHost
- changed:
function formatErrors(diagnostics: ReadonlyArray<typescript.Diagnostic> | undefined, loaderOptions: LoaderOptions, colors: Chalk, compiler: typeof typescript, merge: { file?: string; module?: WebpackModule }, context: string): WebpackError[] → function formatErrors(diagnostics: ReadonlyArray<typescript.Diagnostic> | undefined, loaderOptions: LoaderOptions, colors: Chalk, compiler: typeof typescript, merge: { file?: string; module?: webpack.Module }, context: string): webpack.WebpackError[] - changed:
function fsReadFile(fileName: string, encoding?: string | undefined): string | undefined → function fsReadFile(fileName: string, encoding?: BufferEncoding | undefined): string | undefined - changed:
function makeError(loaderOptions: LoaderOptions, message: string, file: string | undefined, location?: FileLocation, endLocation?: FileLocation): WebpackError → function makeError(loaderOptions: LoaderOptions, message: string, file: string, location?: FileLocation, endLocation?: FileLocation): webpack.WebpackError
- changed:
function makeWatchRun(instance: TSInstance, loader: webpack.loader.LoaderContext): (compiler: webpack.Compiler, callback: (err?: Error | undefined) => void) => void → function makeWatchRun(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): (compiler: webpack.Compiler, callback: (err?: Error) => void) => void