browserify / browser-resolve

resolve function which support the browser field in package.json
MIT License
102 stars 70 forks source link

Expand skipped paths. #72

Closed mtth closed 8 years ago

mtth commented 8 years ago

Path keys corresponding to skipped paths (where the value is false) did not get expanded, so only module IDs were supported. This lets us skip relative paths as well.

defunctzombie commented 8 years ago

Just to make sure I understand this change. Previously a browser field value of:

browser: {
    "./local-file.js": false
}

Would not work when required from another module (require(foo/local-file)) because the path would not be expanded? And this PR fixes that behavior?

mtth commented 8 years ago

This is for requires inside the same package. Assuming the following folder structure (a bit contrived for simplicity):

In this case, we have to set both ./hide and ./lib/hide to false in package.json (which wouldn't be the case if they were just relocated):

browser: {
    "./hide": false,
    "./lib/hide": false
}

With this change, skipped keys behave the same as relocated ones. Hope this makes sense.

defunctzombie commented 8 years ago

Makes perfect sense. Great fix!