mjeanroy/rollup-plugin-license

Suggestion: Use tree-shaking information when generating third party dependencies

lukastaegert opened this issue · 5 comments

At the moment, this plugin will list all imported dependencies in the license file even though I may not be using any code from those dependencies due to tree-shaking.

This could be improved substantially by not relying on the load hook to identify dependencies but instead by using the bundle information in generateBundle, which lists for each chunk the module ids included in the chunk + the rendered length (which should be 0 for tree-shaken modules).

Hi @lukastaegert,
Thanks for the report.
You're totally right, the license should be excluded if the dependency does not appear in the final bundle. I suppose the idea here is to use the modules entry in the ChunkInfo parameter, right?

@lukastaegert I opened a pull request for this, if you few minutes to take a look and tell me if I missed something ;)

I can take a look this evening, thanks for being responsive to this!

Ok, did it right away, thanks!

Hi,
Version 0.10.0 has been published with this feature.