common-to-amd
v0.0.2
Published
commonjs to amd converter
Downloads
7
Readme
commonjs to AMD converter
based on es6-to-amd
Installation
npm install common-to-amd --save
Usage
node
Convert a single file with:
const commonToAmd = require('common-to-amd');
const source = 'var lib = require("./lib"); module.exports = {lib: lib};';
const result = commonToAmd(source);
Example:
commonjs
var lib = require("./lib");
module.exports = {lib: lib};
AMD
define(['./lib'], function (lib) {
'use strict';
return {
lib: lib
};
});