-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
browserify-shim incompatible with other transforms (namely brfs)? #44
Comments
Of course I post under the wrong account, like an idiot. Note that this issue occurs all the way down to |
The error says you are missing the config section in your {
"browserify-shim": {
"jquery": "$"
}
} Adding it as a transform without that section is not sufficient and therefore throws an error.
It's not, |
I have fully-configured Removing either I'll update my repo with |
Ok, sounds good I'll have a look when it's ready. |
I've updated my repo with an example: https://github.com/jkymarsh/grunt-browserify-angular-boilerplate Just run |
Ok, thanks, will have a look tomorrow. |
So I did take a look at this last night, and I'm working on a fix: as the shim inspects each module, it'll check to see if it's a built-in Nodejs module (by comparing against the running instance of However, I did want to ask: do you think it's really necessary to eject from the script if a module doesn't have a section in the |
Thanks, that's kind of what I thought (was swamped today, so no time to look in detail).
No it's not too extreme since using browerify-shim transform but not specifying the config is a developer mistake and it's better to fail early and with a splash instead of keeping you guessing why things don't work. For more info on when to throw and when not philosophy, I'd recommend this post. Looking forward to a PR that fixes this. If this is reproducible via a test, I'd appreciate if you'd add one as well. Thanks. |
With all due respect, this wasn't true in my case - I intentionally left out a config section for the Even with my fix, it'll only cover the built-in modules. I'm worried that someone will come along with some external npm module that has a client-side-compatible abstraction that supports browserification, and we'll then be shit out of luck. I'll still work on my proposed fix and see what you think, but I'd urge you to reconsider your stance. I would agree with you if configuration was required, 100% of the time, but it's not. It can comfortably be omitted for at least 2 dozen modules that we know of, and presumably many more that we don't. |
The fact that it expected one in the |
Checked in a fix for this: I had considerable difficulty coming to what I feel is an extensible solution to this problem. It wasn't as straightforward as I expected, since not only are top-level modules shimmed; their dependencies are as well, meaning just inspecting the Ended up having to inspect the current module being shimmed to see if it resides within the running instance of See what you think. I'd also like to write some tests, but having trouble getting |
@jkymarsh would you consider PR ing with your fix? Also I'm not sure if there isn't an easier way to fix this. Couldn't we just ignore the I'm thinking of something along the lines of: if (/node_modules.browserify.lib.builtin.js$/.test(file)) return through(); added around here LMK what you think. |
@thlorenz As mentioned in my previous comment, just matching/ignoring the To be honest, I'm still sticking to my original opinion that config for |
browserify-shim failed to work in this combination.
No error thrown, anyway shim doesn't seem to work.
|
Trying to add
brfs
to mybrowserify
transforms, ever since the shim moved topackage.json
config:Results in this error every time:
Results in the same error when attempting to use the transform via the command line using the
-t brfs
option.The text was updated successfully, but these errors were encountered: