-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
54 lines (48 loc) · 939 Bytes
/
build.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
const { build, cliopts } = require('estrella');
const Path = require('path');
const [opts, args] = cliopts.parse([
'p, prepare',
'prepare for publish',
]);
const common = {
entry: 'src/main.ts',
bundle: true,
};
if (cliopts.watch) {
build({
...common,
// bundle: true,
outfile: 'dist/main.js',
sourcemap: true,
format: 'iife',
globalName: 'SmartComposer',
});
require('serve-http').createServer({
port: 8181,
indexFilename: 'index.html',
});
}
if (opts.prepare) {
build({
...common,
outfile: 'dist/main.js',
minify: true,
format: 'iife',
globalName: 'SmartComposer',
});
build({
...common,
outfile: 'dist/main.cjs.js',
minify: true,
format: 'cjs',
globalName: 'SmartComposer',
});
build({
...common,
outfile: 'dist/main.esm.js',
minify: true,
format: 'esm',
globalName: 'SmartComposer',
});
}