michaelficarra / commonjs-everywhere

:rainbow: minimal CommonJS browser bundler with aliasing, extensibility, and source maps
BSD 3-Clause "New" or "Revised" License
158 stars 21 forks source link

support for using a custom modules dir for third party modules #107

Open AshHeskes opened 9 years ago

AshHeskes commented 9 years ago

I've added support for passing a root relative dir for looking up third party modules ala node_modules style as explained here

Command Line Usage

cjsifiy app.js --root js/ --modules-dir components/ 

Node Usage

cjsify ( './app.js', __dirname + '/js', { modulesDir : './components' } );

The docs have also been updated.

vendethiel commented 9 years ago

Oh my, yes!

AshHeskes commented 9 years ago

The build is failing at aliasing core modules, which is outside of the scope of my pull request. I was going to open an issue for that anyway, because it appears aliasing just doesn't work in general.

AshHeskes commented 9 years ago

IMO cjs-everywhere shouldn't be responsible for shimming the node env or providing alternatives to node core modules anyway. It should be the job of the dev to utilise packages that are designed for/work with the platform they are targeting.

michaelficarra commented 9 years ago

Can you explain how aliasing doesn't work? We have a significant number of tests for the feature and the latest master build on Travis-CI passed. If you think there is a bug, please open an issue for it. Otherwise, please fix this PR to pass CI before review.