browserify / browser-resolve

resolve function which support the browser field in package.json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ability to specify alt browser mapping, for chromeapp or firefox app, etc.

mvayngrib opened this issue · comments

browserify/browserify#1094

when I browserify for a Chrome app, I want a slightly different mapping than I specify in the "browser" field. It would be cool if I could have an arbitrarily named field and tell browserify to use that instead of "browser", e.g.

browserify --browser=chromeapp main.js > bundle.js

and

"browser": {
  ...
},
"chromeapp": {
  ...
}

it would then default to "browser"

What does @substack think about this? Are any other tools offering this functionality?

This could be a useful feature and straightforward to implement. It would also be useful on the browserify side to turn off the browser field entirely in some cases.

@mvayngrib want to take a stab at a PR please?

sure, I'll take a stab