Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (34 sloc) 869 Bytes

RequireJS commonJS wrap middleware

Easiest way to share your modules between server and client side


Sample config

var config = {
  	baseUrl: '/js/',
	basePath: 'static/js/',
	modules: {
		'your/module/url': {
			path: 'path/to/module'
		// example with dependencies mapping
		'your/another/module/url': {
			path: 'path/to/another/module',
			dependenciesMap: {
				'original/dependency/path': 'new/dependency/url'

As a middleware

var app = express.createServer();

for production at a build script:


You can use the same config for wrapper and builder, but wrapper does not use basePath option, in opposite, builder does not use baseUrl option, but use basePath.