browserify / browser-resolve

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

alt-browser fallback to "browser" for browserification of dependencies? #62

Closed mvayngrib closed 9 years ago

mvayngrib commented 9 years ago

this is a question. If A depends on B, and their package.json's look like:

A:

    {
      ...
      "chromeapp": {
        "dgram": "chrome-dgram"
      },
      "dependencies": {
        "B": "^1.0.0"
      }
      ...
    }

B:

    {
      ...
      "browser": {
        "url": "./browser-url.js"
      }
      ...
    }

when you issue:

    browserify --browser chromeapp A/main.js

should browserify fall back to the "browser" field when it browserifies B and needs to resolve "url" but doesn't find a "chromeapp" field? It seems like in most cases this would be desirable. What do you think?

defunctzombie commented 9 years ago

Good question. What is the current behavior? No fallback? Silent failure? Loud failure?

mvayngrib commented 9 years ago

the current behavior is that it'll look for "chromeapp" in the nested dependency (where only "browser" exists), not find it, and resolve to whatever file/module gets used in the regular node.js environment. So basically it ends up handing you non-browserified deps

defunctzombie commented 9 years ago

fixed in v1.9.0

Thanks!

mvayngrib commented 9 years ago

cool, thx for merging