Do you want to request a feature or report a bug?
Either a bug or unclear docs.
What is the current behavior?
Given entry
is the entry module:
It just uses function1
from external1
module.
I expected that external1.function2
and the whole external2
module would be eliminated.
However, my output includes external2.function1
. Just.. why?
Here’s a repo of the whole thing.
This doesn’t work yet. We don’t do this kind of scope analysis yet, but this is prepared in some places and could be added.
By using
ModuleConcatenationPlugin
, webpack does eliminateexternal2
stuff correctly.Here’s output from webpack 4 with
ModuleConcatenationPlugin
andUglifyJSPlugin
: gist link.Hi, everyone. I am implementing this feature. Here’s my repo:
https://github.com/vincentdchan/webpack-deep-scope-analysis-plugin
And demo, you can experience the analysis:
https://vincentdchan.github.io/webpack-deep-scope-demo/
If things go well, we can use it very soon. It will come faster if anyone can add more tests or edge cases to my repo. Thank you!
@Birowsky have you had a chance to look into the work @vincentdchan has been providing in this case? Hoping to get some feedback for him as this may directly assist with your issue.
Did anything ever come of this? Any plans to integrate @vincentdchan ‘s work?
@dmwyatt Thanks for following. My plugin has been released for a while, and I rarely receive bugs report. I don’t know if it’s really tested by the community even though I have a lot of unit tests. Because shaking wrong modules would make production code crash. I am worried.
@sokra Maybe I could submit a PR for integrating the plugin as an optional parameter, people can choose to use it.
Don’t you dare.
Good boy
Work done in
webpack@5
. Provided example works with latest beta (webpack@5.0.0-beta.14
).I think this issue could be closed @evilebottnawi