Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork190
Update default extensions to match node#145
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Extension list sourced fromhttps://nodejs.org/api/modules.html#modules_file_modulesFixesbrowserify#137
ljharb commentedJan 5, 2018
This overlaps with#20 -#20 (comment) may be relevant here. |
TehShrike commentedJan 5, 2018
TehShrike commentedMar 7, 2018
Given @substack and@bmeck's comments in#137, I think this is the preferred approach over using
Anyone else want to chime in/review? |
ljharb left a comment
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.
This is not my preferred approach; either it should stay as-is, or it should dynamically look up require.extensions.
If the docs are incorrect, let’s fix them.
TehShrike commentedMar 7, 2018
What's your reasoning? The readme says "implements the node
|
ljharb commentedMar 7, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The require.resolve algorithm depends on the runtime value of Hardcoding the array is a breaking change thatalso isn't consistent with require.resolve, so I see no value in ever doing that. |
TehShrike commentedMar 7, 2018
Not supporting a mutable The issue is that the default value for this module's I agree with the other commenters in#137 that inferring defaults from a global mutable is a bad idea. The fix for the bug is to align this package's defaults with node's defaults. |
ljharb commentedMar 7, 2018
The fix for the bug is to make the package behave the same way node does, which means dynamically looking up require.extensions. I'm going to continue to block any change to this package's defaults that aren't changing it to |
snuggs commentedMar 15, 2018
The issue is that the default value for this module's extensions option is different from node's default module resolution extensions. Agreed. So basically this package doesn't do what it claims to do. YES? Either it uses module load strategy or it doesn't. And as@TehShrike pointed out it doesn't therefore even the name of the library is out of touch. Not being a curmudgeon by any means. But facts don't seem to care about our opinions. Is there another library out there I can use? It's not my fault companies decided to use a (now) deprecated feature as an early node supporter. I still have to deal with this and I'd have to drop tape due to resolve and I <3 BOTH projects. /cc@ljharb |
TehShrike commentedMar 15, 2018
A new module could be published, |
snuggs commentedMar 15, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes I don't think@ljharb realizeshow serious this is For people using both tools. For instance is BLOOMBERG right for using I feel a strawman is being thrown up telling people HOW they should write their code when the real issue after all is a project named I can close whatever in respective repos as the client has moved on from resolve and tape. Unfortunate but I'd still make the changes. With people revisiting their resolution strategies (much to do with ESM / On second thought |
ljharb commentedMar 15, 2018
The browserify issue is a different one; anyone who's using The issue here is deciding which of the following is preferable:
My preference between 2 and 3 is decidedly "3". My overall preference is to avoid breaking changes - which cause pain for users - when they are not sufficiently motivated. I'm not yet convinced that "pedantically matching node's resolve algorithm" is actually useful enough to warrant the breaking change. |
TehShrike commentedMar 15, 2018
"pedantically matching node's resolve algorithm" is the whole point of this package. |
snuggs commentedMar 15, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
A breaking change to do what this library actually says the name says it does is a worthy change in my book. At least have the readme say otherwise as you suggested. Trust me I can definitely pick up what you are laying down as well@ljharb. Like I said I no longer have a dog in the fight. People who use tape will have their hands tied behind their backs tho...if they're concerned about file extensions. Seems to be a hot topic these days. I'd prepare. |
snuggs commentedMar 15, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
P.S. To be clear I still feel@TehShrike's workSHOULD be merged in. After all we are simply devs who just want to use this library and nothing more. I thought the whole point of this project was to help people who had some janky legacy resolution coding to maintain without choice...I'm guilty as charged. Please let me know what to do with my respective issues/PR@ljharb. |
Extension list sourced fromhttps://nodejs.org/api/modules.html#modules_file_modulesFixesbrowserify#137
ljharb commentedApr 5, 2018
@TehShrike I haven't changed my position; but for this PR to be merged, it would need tests that would fail without the change. |
snuggs commentedJul 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@ljharb FWIW I know you mentioned earlier awaiting node progress. However to your point in the comment above would it be ok to do an extension lookup Thanks in advance. 🙏 |
TehShrike commentedSep 11, 2018
Added some tests. Let me know if they seem insufficient. |
ljharb left a comment
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.
I think it's also useful to have a test with afoo.js,foo.node, andfoo.json, and specify which one gets picked with both 1) default extensions and 2) a list of two of them. I'd then want to merge that test into master, so that this PR's diff would illustrate the breaking change.
TehShrike commentedSep 11, 2018 via email
Ah yeah, asserting default extension order makes senseJosh …________________________________From: Jordan Harband <notifications@github.com>Sent: Tuesday, September 11, 2018 18:16To: browserify/resolveCc: Josh Duff; MentionSubject: Re: [browserify/resolve] Update default extensions to match node (#145)@ljharb commented on this pull request.I think it's also useful to have a test with a foo.js, foo.node, and foo.json, and specify which one gets picked with both 1) default extensions and 2) a list of two of them. I'd then want to merge that test into master, so that this PR's diff would illustrate the breaking change.—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub<#145 (review)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABFsbW_xCsx_CMDZCt3LvyoHzRxlvIWfks5uaEQwgaJpZM4RTcwU>. |
Uh oh!
There was an error while loading.Please reload this page.
This fixes an issue where
browserify/resolve's default behavior does not match node's behavior.Per the discussion in#137, I updated the hardcoded list of extensions instead of sourcing it from some global.
Extension list sourced fromhttps://nodejs.org/api/modules.html#modules_file_modules
Fixes#137.Closes#138.Closes#20.Closes#166.