Skip to content

Commit

Permalink
Support browser path false of requires without ext
Browse files Browse the repository at this point in the history
It's pretty common for node modules to use require() without specifying the file extension, so adding this will most likely make a few more libraries work with rollup. One project doing this is for instance `object-assign` which doesn't work currently. inspect-js/object-inspect#18

Considering the line that checks for changed paths below does exactly the same it's probably just an oversight that this was missing.
  • Loading branch information
porsager committed Jan 21, 2019
1 parent 73b01b1 commit 39be3cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function nodeResolve ( options = {} ) {
if (options.browser && browserMapCache[importer]) {
const resolvedImportee = resolve( basedir, importee );
const browser = browserMapCache[importer];
if (browser[importee] === false || browser[resolvedImportee] === false) {
if (browser[importee] === false || browser[resolvedImportee] === false || browser[resolvedImportee + '.js'] === false || browser[resolvedImportee + '.json'] === false) {
return ES6_BROWSER_EMPTY;
}
if (browser[importee] || browser[resolvedImportee] || browser[resolvedImportee + '.js'] || browser[resolvedImportee + '.json']) {
Expand Down

0 comments on commit 39be3cc

Please sign in to comment.