-
Notifications
You must be signed in to change notification settings - Fork 31
fix: require is not a function #65
fix: require is not a function #65
Conversation
Thanks for the PR! Let me look into the side effects of that plugin. I'm about to roll a 1.0 version, so if this is slightly breaking, I can still take it. |
So, looking into this. This is a specific issue with folks that use Gently as their stubbing library which interferes with webpack doing its thing. This isn't a catch all fix for #21, but rather a very specific use case. In this particular case, it looks like node-formiddable (used by Superagent) has some Gently stubbing code. Setting I'm not sure I want to take this PR since it's a very specific use case that might have side effects. But I do think I've seen enough cases here where folks want to customize the WebPack config that it's probably time to address that. So my proposal is to offer the option to specify a .js file which will export a method which will be passed the WebPack config. It can then modify it to its liking (including breaking it, so BEWARE). Then you could provide your customize option via: // $root/webpack.config.js
module.exports = function(config) {
config.plugins.push(new webpack.DefinePlugin({ "global.GENTLY": false }));
return config;
} Then when you call pack via the cli, you can specify it in the config file or the cli by giving the direct path name. This allows folks to customize the config however they'd like. Does this sound good, @puhoy? |
Sounds good we are also being affected by this issue, but we are not using the superagent library, so this is potentially quite a widespread problem. |
sounds good. |
@edyau, my point was only that this type of thing can help fix these issues, but it isn't a blanket fix. The libraries themselves need to be compliant. Gently is a pretty popular library, so this should help fix a number of these types of issues. Since it doesn't change WebPack's behavior (which operates by design), you'll still need to figure out, for a given library, why there is require errors. This feature (with @puhoy's updates) is a really powerful tool, though, and should help a lot. |
I stumbled upon a solution for #21 here.
This change seems to fix the problem, but i am not sure if this has other implications..?