requirejs-transpiler
transpile requirejs to ES Module
Compiled Output
An example like this:
define(
[
'jquery'
],
function ($) {
return {
init: function () {
var o = $('#app');
}
};
}
);
and the output will be:
import $ from "jquery";
export default {
init: function () {
var o = $('#app');
}
};
Usage
Install:
npm i requirejs-transpiler
API
const { requirejs-transpiler } = require('requirejs-transpiler')
requirejs-transpiler({
srcBasePath,
srcPattern,
distBasePath,
prettier: true
})
Options
The glob syntax from the glob module is used at srcPattern param.
srcBasePath | true |
srcPattern | false |
distBasePath | false |
prettier | false |
prettierOpts | false |
Contributing