Rename DefinePlugin #13571
matthias-ccri
started this conversation in
Ideas
Rename DefinePlugin
#13571
Replies: 1 comment 1 reply
-
We need improve our docs webpack/webpack.js.org#5087 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider renaming "DefinePlugin" to something more accurate. DefinePlugin does not define anything, at least, not in the typical sense of defining a javascript variable.
See examples of places where people think DefinePlugin can create a global variable:
What DefinePlugin really does is replace a MemberExpression or Identifier with arbitrary code. It does not define any variable either in the local scope or global scope. Correct me if I'm wrong...
Example:
Input:
Output:
Console:
This shows that there is no real
ABC
variable being defined anywhere. Many people don't realize that webpack is simply replacing code.Is it too late to change this plugin's name? Something like
ReplaceVariablesPlugin
? Maybe keep DefinePlugin an alias?At the very least, the docs page should revise its description:
^ this isn't really true.
Anyway, all the best. Let me know what you think. Thanks 👍
Beta Was this translation helpful? Give feedback.
All reactions