-
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
Gets a basic deep module reference test working with 1.1.0 node-resolve #54
Conversation
@@ -73,6 +73,15 @@ test('object browser field as main', function(done) { | |||
}); | |||
}); | |||
|
|||
test('deep module reference mapping', function(done) { | |||
resolve('module-l/direct', { basedir: __dirname+"/fixtures", package: { main: 'fixtures' } }, function(err, path, pkg) { |
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.
single quotes please
@justinbmeyer This is all that is necessary to make direct require work and be able to shim via browser field in the nested modules? |
Once you make the style changes, please squash into a single commit and reference the original discussion as you have. Great job on following this through! |
@defunctzombie Yes, it seems like this is all that is needed as most of the hard work is now being done in node-resolve. I tested this against the workflow in CanJS (where CanJS has everything in I will hopefully get the pull request cleaned up for tomorrow. Thanks! |
…h 1.1.0 node-resolve
Updated. Thanks! |
Gets a basic deep module reference test working with 1.1.0 node-resolve
published in v1.7.0 Thanks! |
Now this seems to break browserify for me when I resolve files that are not |
@mantoni Can you add a breaking test? Or give a small breaking example. What error do you get? I can get in a patch asap. |
@justinbmeyer Thanks. Had to run away. Will try and isolate tomorrow. |
return; | ||
} | ||
|
||
if(typeof info.browser) { |
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.
Shouldn't this be if (typeof info.browser === 'object')
?
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.
Ugg, patch incoming
Sent from my iPhone
On Feb 10, 2015, at 2:10 AM, Maximilian Antoni notifications@github.com wrote:
In index.js:
- opts.pathFilter = function(info, path, relativePath) {
if(relativePath[0] != '.') {
relativePath = './' + relativePath;
}
var mappedPath;
if(pathFilter) {
mappedPath = pathFilter.apply(this, arguments);
}
if(mappedPath) {
return mappedPath;
}
if(!info.browser) {
return;
}
Shouldn't this be if (typeof info.browser === 'object')?if(typeof info.browser) {
—
Reply to this email directly or view it on GitHub.
Narrowed it down to this: browserify/resolve#69 |
For #51, this uses the 1.1.0 node-resolve to make deep module references mappable.
It works by adding a pathFilter that checks
browser
for a matching key and returns that value. It handles if the user does or does not end the map with.js
.It includes a test.
Thanks!