-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack 5 support #435
Comments
@marcneander Thanks for reporting this! It probably depends on the exact version of webpack 5 that you're using and might be related to a few other factors. A reproduction repository would be very nice - you could possibly also do this on codesandbox.com |
fwiw: I had no issues using the plugin with webpack 5. |
Same issue here. |
I see two distinct deprecation warnings and one error on a project that has child compilers and other advanced stuff. Making a repro would be hard but I guess you can work off these messages. Most are related to deprecated APIs.
|
I ran into the same error message with webpack 4. I think this is happening because
So we are ending up with a license file for only the modules referenced by the last chunk. |
same issue here. |
This plugin hooks into the compilers Webpack's documentation for plugin developers is severely lacking. I tried getting rid of the deprecation warnings, but could not do it without impacting this plugins functionality. If any of you can help here, it would be very appreciated. Speaking of errors like the |
I have no times for fixing this full-featured plugin for now, but I made tiny license plugin for my project, It exports single It looks like below. class ExampleWebpackPlugin {
apply(compiler) {
// use emit hook not compilation
compiler.hooks.emit.tapAsync(
"ExampleWebpackPlugin",
(compilation, callback) => {
// run at once
// initializing something here
compilation.chunks.forEach(
(chunk) => {
// run for each chunks
// some license fetch code here
}
);
// run at once here
// set license output to compilation.assets here
callback();
}
);
}
} bit differences from webpack-license-plugin
I hope this helps something. |
Attaching repro: λ: $ cd repro
λ:repro $ npm install
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
added 569 packages, and audited 570 packages in 11s
32 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
λ:repro $ npm run build
> [email protected] build
> webpack --mode production
(node:12280) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:12280) [DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API
(node:12280) [DEP_WEBPACK_CHUNK_ENTRY_MODULE] DeprecationWarning: Chunk.entryModule: Use new ChunkGraph API
(node:12280) UnhandledPromiseRejectionWarning: Error: Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)
at Chunk.get entryModule [as entryModule] (/Users/slawo/Desktop/repro/node_modules/webpack/lib/Chunk.js:119:10)
at WebpackChunkModuleIterator.iterateModules (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackChunkModuleIterator.js:42:19)
at WebpackChunkIterator.iterateChunks (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackChunkIterator.js:30:37)
at WebpackLicensePlugin.<anonymous> (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:90:51)
at step (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:33:23)
at Object.next (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:14:53)
at /Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:4:12)
at WebpackLicensePlugin.handleChunkAssetOptimization (/Users/slawo/Desktop/repro/node_modules/webpack-license-plugin/dist/WebpackLicensePlugin.js:80:16)
(node:12280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
λ:repro $ |
Hi, I have the same problem. The output from @slawo-ch matches mine exactly. Is there ongoing development towards a fix? Or is there a workaround that I can use in the meantime? This is the only project I found doing what I wanted. |
Fixed by #510, released as |
I still have errors with webpack 5 with version 4.2.2 installed
From WebpackLicencePlugin.ts line 70
|
I too still get it, with webpack 5 and version 4.2.2 |
Hello! Thanks for a great plugin!
We're getting errors using webpack 5.
Conflict: Multiple assets emit different content to the same filename oss-licenses.json
.I can create a repro repo but don't have time for that right now.
The text was updated successfully, but these errors were encountered: