require2commonjs
This tool helps you convert your js module from AMD to CommonJS form, which could be used in commonjs system like nodejs, cortex, spm
Especially when you manage your js files via requirejs, you can pass config in requirejs like root, baseUrl, paths as options, to make =r2cjs= handle your relative dependencies correctly.
Code like following:
will be transformed to:
var Layout = ;var Backbone = ;var $ = zepto; var App = {}; $; Applayout = ; moduleexports = App;
Installation
$ npm install require2commonjs --save
Usage
r2cjs --root . --baseUrl app base.js
Convert one file
r2cjs rq.js > common.js# orr2cjs rq.js -o common.js
Convert multiple files
r2cjs --dest ../common base.js app.js layout.js
APIs
var r2c = ; ;
Licence
MIT