diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c3d066d..468b24ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v9.0.1 + +* [Use correct hook for emitting additional assets during compilation](https://github.com/TypeStrong/ts-loader/pull/1286) - thanks @jonwallsten + ## v9.0.0 Breaking changes: diff --git a/package.json b/package.json index 3297f7365..05317cfa8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "9.0.0", + "version": "9.0.1", "description": "TypeScript loader for webpack", "main": "index.js", "types": "dist", diff --git a/src/instances.ts b/src/instances.ts index 6b4fcc76f..d554d195e 100644 --- a/src/instances.ts +++ b/src/instances.ts @@ -314,10 +314,16 @@ function addAssetHooks(loader: WebpackLoaderContext, instance: TSInstance) { ); const makeAssetsCallback = (compilation: webpack.Compilation) => { - compilation.hooks.afterProcessAssets.tap('ts-loader', () => - cachedMakeAfterCompile(compilation, () => { - return null; - }) + compilation.hooks.processAssets.tap( + { + name: 'ts-loader', + stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, + }, + () => { + cachedMakeAfterCompile(compilation, () => { + return null; + }); + } ); }; @@ -327,10 +333,6 @@ function addAssetHooks(loader: WebpackLoaderContext, instance: TSInstance) { // For future calls in watch mode we need to watch for a new compilation and add the hook loader._compiler.hooks.compilation.tap('ts-loader', makeAssetsCallback); - - // It may be better to add assets at the processAssets stage (https://webpack.js.org/api/compilation-hooks/#processassets) - // This requires Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, which does not exist in webpack4 - // Consider changing this when ts-loader is built using webpack5 } export function initializeInstance(