Shopify / sprockets-commoner

Use Babel in Sprockets to compile JavaScript modules for the browser
MIT License
182 stars 22 forks source link

Use browser-resolve #4

Closed bouk closed 8 years ago

bouk commented 8 years ago

@lemonmade some packages use the browser field to replace some files that use nodejs modules to instead of browser-based modules. This adds support for the browser field by using https://github.com/defunctzombie/node-browser-resolve (which browserify also uses).

The way it uses it is by injecting it as an opt into the babel-plugin-sprockets-commoner-internal options so that we don't need to vendor it (but maybe we should?)

bouk commented 8 years ago

After this PR is merged I want to integrate https://github.com/substack/node-browserify/blob/master/lib/builtins.js so that we support the built in nodejs packages, which a bunch of npm packages (of course) depend on (including Relay, which is how I ran into this).