Fork me on GitHub

Mappings

  • You can map web's root / to a directory of your nodejs environment (--webRootMap CMD option or webRootMap in config). The directory can be relative to bundle (paths starting with a ., eg '../myWebRoot') or an absolute file system path (eg '/dev/jslibs'). Just make sure your Web Server has the right content mapped to / and you're set for both browser & nodejs!

  • You can use the requirejs config baseUrl and paths on nodejs (only those for now) - just place a file named requirejs.config.json in your bundle root directory, with content like {"paths": {"myLib" : "../../myLib"}}. Very useful for 'importing' bundles, eg running specs against 'myLib' bundle using mocha, jasmine-node etc. Again, use the same config items on RequireJS/Web for transparent cross platform module usage.