thlorenz / proxyquireify

browserify >= v2 version of proxyquire. Mocks out browserify's require to allow stubbing out dependencies while testing.
MIT License
152 stars 24 forks source link

"browser" package.json config broken #3

Closed actionshrimp closed 11 years ago

actionshrimp commented 11 years ago

Browserify supports a "browser" setting in the package.json, so you can add for example:

...
"browser": {
    "jquery": "jquery-browserify"
}
...

into the package.json, and browserify will replace modules loaded with require('jquery') in your code with the mapped module (in the example it would be 'jquery-browserify').

It looks like some of proxyquireify's magic is breaking this, as I get an error during bundling saying that browserify can't open

/full/path/to/project/jquery-browserify, when it should be looking in /full/path/to/project/node_modules/jquery-browserify.

I can change the package.json to "./node_modules/jquery-browserify/lib/jquery.js" for the time being and it works.

actionshrimp commented 11 years ago

Ah this must actually be a bug with the older (2.10.0) version of browserify rather than proxyquireify. If i just use browserify directly (not via proxyquireify) on that version I get the same problem. Should probably have tried that first.

Sorry for spamming you all morning!