antiaris-transform-commonjs-modules-systemjs
v1.3.0
Published
Transform commonjs to systemjs
Downloads
2
Maintainers
Readme
antiaris-transform-commonjs-modules-systemjs
CommonJS 风格模块转换为 System.register 风格。
import {transform, transformFile} from 'antiaris-transform-commonjs-modules-systemjs';
transform('require("./bar.js");\nmodule.exports = 43;', {
moduleId: 'foo',
isStrict: true,
isSlient: true,
translateDep: function(dep) {
return path.basename(dep, '.js');
}
}, function(err, result) {
console.log(result.code);
/*System.registerDynamic('foo', ['bar'], true, function(require, exports, module) {
var define, global = this, GLOBAL = this;
require('bar');
module.exports = 43;
return module.exports;
});*/
});
ES2015 modules 语法将会被忽略。