-
Notifications
You must be signed in to change notification settings - Fork 70
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
feature: resolve main reference to other modules #84
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,4 @@ | |||
{ | |||
"main": "./main.js", | |||
"browser": "module-b" |
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 the feature that previously did not work?
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.
yep
On 10 Sep 2016, at 17:28, Roman Shtylman notifications@github.com wrote:
In test/fixtures/node_modules/module-t/package.json:
@@ -0,0 +1,4 @@
+{
- "main": "./main.js",
- "browser": "module-b"
this is the feature that previously did not work?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@substack @sokra @Rich-Harris for additional review |
bumping.. is there anything else required before we can land this? |
@defunctzombie ..? |
i don't have numbers on this but i've definitely seen it in the wild so support for that should not be dropped. it looks like |
@pemrouz if you're still interested in working on this i can review later this week. no guarantees that defunctzombie will have time in the near future to do merges/releases ofc :) i don't think webpack uses browser-resolve these days, unsure about rollup. it'd be good to check if webpack's enhanced-resolve already supports this too. |
Related: #83
Notes:
I tried to keep changes to a minimal
I reused this check to differentiate references to module/file.
This does mean that there are a number modules that specify
"browser": "browser.js"
which would be invalid. It seems better to try align this with how require works for less confusion in the long-term (i.e.require('./browser.js')
vsrequire('browser.js')
, but if there is a lot of breakage an additional check could always be added for.js
. I'm happy to go on a PR-spree for the browserify modules that do this.The tests added pin down behaviour for the following few use cases:
browserify .
on a module which hasbrowser
set to another modulebrowserify main.js
(wheremain.js
is referenced bymain
in package.json)require('module-a')
frommodule-b
(note: the replacement for module-a is resolved relative to itself)