From 15217322de142323564fdf87bfadd75e18da59af Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Thu, 18 Mar 2021 16:54:52 -0400 Subject: [PATCH] fix(@ngtools/webpack): use correct Webpack asset stage in resource loader The asset extraction within the Angular compiler plugin resource loader needs to occur at the end of the Webpack asset processing pipeline. This ensures that all analysis and preprocessing of the asset have been performed before the resource asset is extracted from the Webpack child compilation. --- packages/ngtools/webpack/src/resource_loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ngtools/webpack/src/resource_loader.ts b/packages/ngtools/webpack/src/resource_loader.ts index a3cb988c9f47..92af35ec1a13 100644 --- a/packages/ngtools/webpack/src/resource_loader.ts +++ b/packages/ngtools/webpack/src/resource_loader.ts @@ -136,7 +136,7 @@ export class WebpackResourceLoader { if (isWebpackFiveOrHigher()) { childCompiler.hooks.compilation.tap('angular-compiler', (childCompilation) => { // tslint:disable-next-line: no-any - (childCompilation.hooks as any).processAssets.tap('angular-compiler', () => { + (childCompilation.hooks as any).processAssets.tap({name: 'angular-compiler', stage: 5000}, () => { finalContent = childCompilation.assets[filePath]?.source().toString(); finalMap = childCompilation.assets[filePath + '.map']?.source().toString();