xz64 / license-webpack-plugin

Outputs licenses from 3rd party libraries to a file
ISC License
165 stars 51 forks source link

Version 4.0.1 fails when using dynamic imports #119

Closed annervisser closed 2 years ago

annervisser commented 2 years ago

🐞 Bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: 4.0.0

Description

When running a production build of Angular 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)

πŸ”¬ Minimal Reproduction

The problem is caused by the changes in commit https://github.com/xz64/license-webpack-plugin/commit/55dd3f87c8f19338e45affec6f2271f75a0167ad

πŸ”₯ 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
markjm commented 2 years ago

will fix today - thanks

xz64 commented 2 years ago

Fixed in v4.0.2