-
Notifications
You must be signed in to change notification settings - Fork 57
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
Reference webpack.DefinePlugin
in the readme
#53
Comments
webpack.DefinePlugin
in the readme`webpack.DefinePlugin
in the readme
@fregante Isn't that DefinePlugin can operate only on entry points while string-replace-loader can update any file ? |
DefinePlugin will operate on any file in the dependency graph. I think that’s the same for this loader, I don’t think it will actually pick files directly from the file system |
@fregante i would have to double check it but i didn't have luck to make DefinePlugin (search / replace functionality ) work with any other file than entry point. |
In Refined GitHub we replace a variable in sub-dependencies of the entry point:
|
Thanks. Unfortunately, our project architecture is much more complicated and the file we would like to update with DefinePlugin is not referenced from entry point . |
Right. As I said in my first paragraph:
What you want to do probably isn't covered by that plugin — which, by the way, works on any JS file; its import position doesn't matter as long as you use it as it's supposed to be used. |
I've refactored my project so that i can use DefinePlugin , so - case closed. |
hi folks. the mentioned |
Because why use a 3rd party loader when you can do it "natively" and with less config?
If the intent of this module is to help the user, let's direct them to better solutions. |
as i mentioned in the previous comment, this, i believe, makes both just different tools, use-cases of which intersect but are not equal by any means. which invalidates the "why 3rd party loader" question, in my opinion. examples defined in readme are plain variable replacement ones, but this does not deny the point i wrote above, as well as does not mean that more complex examples should be added to justify its existence (or does it? and does this module lack examples overall?). what may be a justified thing to do is to reference the DefinePlugin in a form like "yo btw, if what you're doing is a simple & global variable replacement, you may be able to achieve it via DefinePlugin, read more here". but the emphasis on examples seems a bit over the top to me (i might be wrong tho). |
webpack.DefinePlugin
offer a native way to run simple replacements, which covers the first example.I can open a PR that adds a link to this issue as documentation in the readme, and add more examples, including dynamic ones like refined-github/refined-github@130c110
With this loader
With
DefinePlugin
The text was updated successfully, but these errors were encountered: