ef4 / ember-browserify

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

Error importing library that requires another dependency #70

Closed wireframe closed 8 years ago

wireframe commented 8 years ago

my package.json:

"devDependencies": {
  "foo": "1.0.0"
}

my component

import Foo from 'foo';

node_modules/foo/package.json:

"dependencies": {
  "bar": "1.0.0"
}

node_modules/foo/index.js:

baz = require('bar').baz;

Error:

Uncaught TypeError: Cannot read property 'baz' of undefined
wireframe commented 8 years ago

I can almost fix this by hacking the library to:

baz = require('npm:bar').default.baz;

but that's not something i can ship. is there a way to pre/post process the library to find the proper dependency?

wireframe commented 8 years ago

for additional context, here's a demo repository w/ a brand new ember app that demonstrates the issue: https://github.com/wireframe/ember-browserify-demo

and the specific commit/patch that breaks the app here: https://github.com/wireframe/ember-browserify-demo/commit/90eab9e93b6f7d074a71a2fe509f50a06ae32126

stefanpenner commented 8 years ago

I don't know if this is an issue with this library. It seems like your dependency loads a native dependency, im not clear how it can be browserified

stefanpenner commented 8 years ago

Ya, just double checked this library just appears to not browserify. (lots of stuff on npm doesn't) I dont think we can do much. ;(