commonjs-everywhere icon indicating copy to clipboard operation
commonjs-everywhere copied to clipboard

support for using a custom modules dir for third party modules

Open AshHeskes opened this issue 10 years ago • 4 comments

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.

AshHeskes avatar Dec 02 '14 15:12 AshHeskes

Oh my, yes!

vendethiel avatar Dec 02 '14 15:12 vendethiel

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 avatar Dec 02 '14 15:12 AshHeskes

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.

AshHeskes avatar Dec 02 '14 15:12 AshHeskes

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.

michaelficarra avatar Dec 02 '14 17:12 michaelficarra