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: 13.2.1
Description
When running a production build with version 13.2.2, it fails with an error after chunk generation completes.
This relates to using a dynamic import of a json file.
The error is: An unhandled exception occurred: Cannot read properties of undefined (reading 'name')
(see below for extended error)
ng serve does not have this problem.
🔬 Minimal Reproduction
- A dynamic import of a json file:
import(`../../../../../assets/animations/${this.animation}.json`).then(animation => {
- causes the error (
Cannot read properties of undefined (reading 'name')
- Because in function
extractIdentifiedModule
thedirectory
andpackageJson
are undefined
The problem is caused by license-webpack-plugin@4.0.1, specifically the changes in commit xz64/license-webpack-plugin@55dd3f8
Also reported as bug to license-webpack-plugin
: xz64/license-webpack-plugin#119
🔥 Exception or Error
Error
✔ Browser application bundle generation complete.
An unhandled exception occurred: Cannot read properties of undefined (reading 'name')
See "/tmp/ng-IvNqNx/angular-errors.log" for further details.
angular-errors.log
:
[error] HookWebpackError: Cannot read properties of undefined (reading 'name')
at makeWebpackError (/scienta/resources/script/node_modules/webpack/lib/HookWebpackError.js:48:9)
at /scienta/resources/script/node_modules/webpack/lib/Compilation.js:3057:12
at eval (eval at create (/scienta/resources/script/node_modules/tapable/lib/HookCodeFactory.js:33:10), :31:1)
at fn (/scienta/resources/script/node_modules/webpack/lib/Compilation.js:478:17)
at _next4 (eval at create (/scienta/resources/script/node_modules/tapable/lib/HookCodeFactory.js:33:10), :28:1)
at eval (eval at create (/scienta/resources/script/node_modules/tapable/lib/HookCodeFactory.js:33:10), :46:1)
at fn (/scienta/resources/script/node_modules/webpack/lib/Compilation.js:490:9)
at _next3 (eval at create (/scienta/resources/script/node_modules/tapable/lib/HookCodeFactory.js:33:10), :41:1)
at eval (eval at create (/scienta/resources/script/node_modules/tapable/lib/HookCodeFactory.js:33:10), :60:1)
at runMicrotasks ()
-- inner error --
TypeError: Cannot read properties of undefined (reading 'name')
at PluginChunkReadHandler.extractIdentifiedModule (/scienta/resources/script/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:39:35)
at /scienta/resources/script/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:21:46
at WebpackInnerModuleIterator.internalCallback (/scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackInnerModuleIterator.js:39:13)
at WebpackInnerModuleIterator.iterateModules (/scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackInnerModuleIterator.js:21:9)
at /scienta/resources/script/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:20:39
at WebpackChunkModuleIterator.iterateModules (/scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackChunkModuleIterator.js:28:21)
at PluginChunkReadHandler.processChunk (/scienta/resources/script/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:19:29)
at _loop_1 (/scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:135:37)
at WebpackCompilerHandler.iterateChunks (/scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:160:17)
at /scienta/resources/script/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:50:31
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.2.2
Node: 16.13.2
Package Manager: yarn 1.22.15
OS: linux x64
Angular: 13.2.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1302.2
@angular-devkit/build-angular 13.2.2
@angular-devkit/core 13.2.2
@angular-devkit/schematics 13.2.2
@angular/cli 13.2.2
@schematics/angular 13.2.2
rxjs 6.6.7
typescript 4.5.5