Closed sompylasar closed 5 years ago
👍for an option to disable unused files, I will work on it. Currently, webpack-deadcode-plugin
is based on webpack
to analyze which is an unused file or unused export. I think each module builders has its own mechanism to detect, therefore without using webpack
(in this case) it is really difficult
thanks @sompylasar. Sorry for the late release
Looks great, thanks! For reference, the relevant code change is here: https://github.com/MQuy/webpack-deadcode-plugin/commit/917184b188ba0f958ae9e8c5f57992d9eb0c4968
I've got a large multi-entrypoint codebase where webpack builds just two of the entrypoints and builds them separately from each other. Some files within the source directories listed in the
patterns
option are only used by one of the entry points, but not the others (and not by those built by webpack). I excluded the test files by a glob, but it would be impractical to exclude specific modules making the build config dependent on the code structure.The unused files output got too misleading and gave too many false positives (warnings of unused files).
The unused exports output got almost everything right (except for a couple exports that were actually used, can't figure out how it could find the other ones but not these few).
Or maybe there's a better way to make it truly reflect what's used across all files, not just those included in the webpack build, to avoid false positives. Or a better tool that you know of. I tried https://github.com/yamafaktory/shrimpit before and it worked for too long parsing all the files.
Thanks.