xz64 / license-webpack-plugin

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

Licenses of ES modules in concatenated modules are not emitted #116

Open iorate opened 2 years ago

iorate commented 2 years ago

Hello, thank you for this useful plugin.

license-webpack-plugin does not extract licenses of ES modules included in module concatenation with the latest version of webpack 5. The repository to reproduce this issue is here: https://github.com/iorate/license-webpack-plugin-concatenated-modules

webpack concatenates ES modules if possible in production mode, and gives them identifiers of form javascript/esm|<path>. The current version of license-webpack-plugin does not handle identifiers of this form: https://github.com/xz64/license-webpack-plugin/blob/185efbc9f3a11710bb910453cba3c8b7b9385405/src/WebpackModuleFileIterator.ts#L36-L69 ... and does not emit licenses of modules with such identifiers.

Versions

node.js 16.13.2 webpack 5.66.0 license-webpack-plugin 4.0.0

jayaddison commented 1 year ago

Note: in addition to the workaround listed in the linked repository: webpack v4 and v5 also support an optimization.concatenateModules option that can be disabled and should allow affected licenses to be (re)discovered as expected.