Last active
August 29, 2015 14:04
-
-
Save KidkArolis/65caaa958f66bd46dbe6 to your computer and use it in GitHub Desktop.
Convert CJS to AMD using r.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requirejs = require("requirejs") | |
requirejs.tools.useLib("build", function (req) { | |
req(["commonJs"], function (cjs) { | |
// first arg is filename (not sure why that matters yet) | |
// second arg - the code | |
var converted = cjs.convert("foo", "module.exports = 42;"); | |
console.log(converted); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment