-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
ModuleConcatenationPlugin bailout because of undefined injected global #8152
Comments
webpack <= 4 doesn't support concatenation of injected variables. webpack 5 does support it. |
Wow! I've just tried the Webpack 5 and the module got concatenated. However, Webpack included some |
This is not new. |
Thank you very much for reply! I'm closing this issue as this feature will be coming in Webpack 5. |
Bug report
What is the current behavior?
The ModuleConcatenationPlugin fails to hoist modules that use a global variable even when the global variable is undefined in the target environment.
The example is
process
,__dirname
and other variables from Module VariablesSteps to reproduce.
Please see a gist: https://gist.github.com/ludekstepan/368d5f56afc195e473a6a9d897a5e164
When compiled, the webpack outputs:
And the compiled
dist/main.js
contains two modules:If I change the
__dirname
in the dependency module to some other undefined global (like:__foo
), the concatenation works as expected.I want to optimize for size and performance as much as possible, and the concrete application that causes me trouble is: use of
process
in @most/schedulerWhat is the expected behavior?
I expect the ModuleConcatenationPlugin to consider only global variables specific to the target environment.
Other relevant information:
webpack version: 4.20.2
The text was updated successfully, but these errors were encountered: