Nodejitsu free for Open Source programFork me on GitHub

nodejs Template

Convert to pure nodejs module format

You can issue a urequire nodejs or build: template: 'nodejs' instead of the standard/recommended UMD (Universal Module Definition) format.

Converted modules dont have a dependency on npm install uRequire to run.

It converts modules with a pure nodejs template, without uRequire's special require, thus loosing a lot of functionality:

  • Runtime translation of paths like models/PersonModel to ../../models/PersonModel, depending on where it was called from. You 'll still get build-time translated bundleRelative paths, to their nodejs fileRelative equivalent.

  • Can't use the asynchronous version of require(['dep'], function(dep){...})

  • Can't run requirejs loader plugins, like text!... or json!...

  • There's no mapping of /, ie webRootMap etc or using the requirejs.config's {baseUrl:"...."} or {paths:"lib":"../../lib"}

NOTE: You can also consider 'UMDplain' template, that has the same limitations as 'nodejs' on nodejs (again with no dependency on urequire), but the modules are ready to execute on both nodejs and Web/AMD.