Closed
Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, the previous version in which this bug was not present was: 11.xDescription
As of Angular 12, the AngularWebpackPlugin
throws an error when used in conjunction with the git-revision-webpack-plugin. The git-revision-webpack-plugin creates additional outputs that do not specify the optional sourceFilename
field, but the AngularWebpackPlugin
requires this field.
🔬 Minimal Reproduction
A webpack.config.js
that specifies both plugins will fail:
const { AngularWebpackPlugin } = require('@ngtools/webpack');
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.[jt]sx?$/,
loader: '@ngtools/webpack',
},
],
},
plugins: [
new AngularWebpackPlugin(),
new GitRevisionPlugin(),
],
};
🔥 Exception or Error
/app/node_modules/@ngtools/webpack/src/resource_loader.js:207
throw new Error(`'${name}' asset info 'sourceFilename' is 'undefined'.`);
^
Error: 'COMMITHASH' asset info 'sourceFilename' is 'undefined'.
at /app/node_modules/@ngtools/webpack/src/resource_loader.js:207:35
at /app/node_modules/webpack/lib/Compiler.js:538:11
at /app/node_modules/webpack/lib/Compiler.js:1106:17
at Hook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/app/node_modules/tapable/lib/Hook.js:18:14)
at /app/node_modules/webpack/lib/Compiler.js:1102:33
at finalCallback (/app/node_modules/webpack/lib/Compilation.js:2249:11)
at /app/node_modules/webpack/lib/Compilation.js:2540:11
at Hook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/app/node_modules/tapable/lib/Hook.js:18:14)
🌍 Your Environment
Angular CLI: 12.1.1
Node: 14.15.1
Package Manager: yarn 1.22.5
OS: linux x64
Angular: 12.1.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, upgrade
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1201.1
@angular-devkit/build-angular 12.1.1
@angular-devkit/core 12.1.1
@angular-devkit/schematics 12.1.1
@ngtools/webpack 12.1.1
@schematics/angular 12.1.1
rxjs 6.6.7
typescript 4.3.5
webpack 5.41.1
Anything else relevant?
Related issue in the git-revision-webpack-plugin repo: pirelenito/git-revision-webpack-plugin#69