forked from sandflow/imscJS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.esm.js
38 lines (30 loc) · 1.01 KB
/
gulpfile.esm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gulp from "gulp";
const rollup = require('rollup');
import {terser} from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from "@rollup/plugin-commonjs";
import nodePolyfills from 'rollup-plugin-node-polyfills';
//no unit tests or jshint or anything, just piggyback on the grunt ones and assume it'll be run together.
function bundle(debug) {
const inConfig = {
input: './src/main/js/main.js',
plugins: [
resolve({browser: true, preferBuiltins: false}),
commonjs(),
nodePolyfills()
]
};
if (!debug) {
inConfig.plugins.push(terser());
}
const outConfig = {
format: "esm",
file: 'dist/imsc.all.' + (debug ? 'debug' : 'min') + '.mjs'
};
return rollup.rollup(inConfig)
.then(bundle => {
return bundle.write(outConfig)
});
};
exports.both = gulp.parallel(bundle.bind(null, true), bundle.bind(null, false));
exports.default = exports.both;