-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Make behavior consistent with require.resolve() for "shadowed" core modules #148
Make behavior consistent with require.resolve() for "shadowed" core modules #148
Conversation
Test looks great (along with the appropriate fixtures). |
I'm a bit stumped on how to proceed. Internally to Node's As a result, short of shipping a white list of known-to-be-internal module names, I'm unsure of any solution that wouldn't reach into Node internals, which (I presume) would defeat the purpose of this module for use in browserify'd code. Is there anything in |
We already have a whitelist of known-to-be-core module names; what's an example of an "internal" module name you'd want to use? |
Well, the example I've been using all along is "util", which I'm sure you have covered. I'd also expect not-publicly-documented-but-publicly-accessible modules like Where is this list so this condition can use it? |
Given 'util' as an example native module which is also installed as an npm package, then in order for browserify/resolve to act consistently with native `require.resolve`, these should be true: ``` resolve.sync('util') // returns 'util' resolve.sync('util/') // returns 'node_modules/util/index.js' ```
I got this new test passing, but identified what I think will be a problem in that this new behavior conflicts with #25. It's my opinion that #25 was essentially incomplete/incorrect, because even as far back as 0.10.48, Since it's duplicative, I would recommend deleting the tests @michaelficarra added in #25. (which I did here: d00883c ) This does raise a decision point, however, which is that surely there are people who are depending on this behavior. Perhaps they want to shadow, maybe even transitively, a native module with an npm package and don't want to or cannot change the string passed to Thoughts? |
These are obviated by the shadowed_core test added in browserify#148
These are obviated by the shadowed_core test added in browserify#148
Given the comments on that issue, I think you're right - let's make sure we're testing the proper thing, and if this is a breaking change, so be it (there's others I can make at the same time). If someone's doing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - since this is breaking, I'm going to let it sit a bit before merging.
Thanks @ljharb -- how will you know that it's sat long enough? I've got a few users waiting on this to land, because it's causing an upstream bug in testdouble.js |
I'm traveling atm, but after I'm back in town, I plan to try to merge any outstanding non-breaking items, and cut a release, and then i'll take another look at this one. |
Cool, let me know if I can help
|
60a5568
to
b2e51ef
Compare
These are obviated by the shadowed_core test added in browserify#148
b2e51ef
to
7faf457
Compare
These are obviated by the shadowed_core test added in browserify#148
7faf457
to
ce2ebb1
Compare
These are obviated by the shadowed_core test added in browserify#148
ce2ebb1
to
9e3104b
Compare
Yay! As soon as you cut a release, I can fix the downstream issues my users were having |
Looks like this landed in 1.7.1 -- Thanks @ljharb! |
This has not yet actually landed in v1; I'll try to backport it. |
…core modules Backports #148 into v1.
Done in 4c9b260; it'll be in the next v1 release. |
- [Fix] `node-modules-paths`: correctly resolve paths that are on Windows networked drives (browserify#156) - [Fix] Make behavior consistent with require.resolve() for "shadowed" core modules (browserify#148)
Resolves #147
Hows this look for a start?