ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

ember-browserify imports `browser` version under Fastboot #114

Open gabrielgrant opened 7 years ago

gabrielgrant commented 7 years ago

Previously filed under fastboot as ember-fastboot/ember-cli-fastboot#370

browserify defines a browser field in package.json as the recommended method for library authors to account for the differences between a browser and node environment in universal JS packages. This allows, for example, using the same websocket API in client-side and browser-side code: https://github.com/gabrielgrant/javascript-universal-websocket-client

Unfortunately, under fastboot ember-browserify still tries to use the browser implementation despite running in Node.

When running under fastboot, it seems ember-browserify should compile using browserify's --no-browser-field flag: "Turn off package.json browser field resolution. This is also handy if you need to run a bundle in node."