browser-resolve
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -177,3 +177,5 @@ // builtin | ||
var replace_main = info.browser[info.main || './index.js']; | ||
var replace_main = info.browser[info.main || './index.js'] || | ||
info.browser['./' + info.main || './index.js']; | ||
info.main = replace_main || info.main; | ||
@@ -180,0 +182,0 @@ return info; |
{ | ||
"name": "browser-resolve", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "resolve which handles browser field support in package.json", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,2 +64,14 @@ var assert = require('assert'); | ||
// package.json has browser field as object | ||
// one of the keys replaces the main file | ||
// however the main has no prefix and browser uses ./ prefix for the same file | ||
test('object browser field as main', function(done) { | ||
resolve('module-k', { paths: [ fixtures_dir ], package: { main: 'fixtures' } }, function(err, path, pkg) { | ||
assert.ifError(err); | ||
assert.equal(path, require.resolve('./fixtures/node_modules/module-k/browser')); | ||
assert.equal(pkg.main, './browser.js'); | ||
done(); | ||
}); | ||
}); | ||
// browser field in package.json maps ./foo.js -> ./browser.js | ||
@@ -66,0 +78,0 @@ // when we resolve ./foo while in module-e, this mapping should take effect |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25649
60
561