commonjs-everywhere
commonjs-everywhere copied to clipboard
support for using a custom modules dir for third party modules
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.
Oh my, yes!
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.
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.
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.