-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.umd.js
40 lines (37 loc) · 1.07 KB
/
build.umd.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
const path = require('path');
const esbuild = require('esbuild');
const SRC_PATH = path.join(__dirname, 'src');
const BUILD_PATH = path.join(__dirname, 'build/umd');
const isProduction = process.env.NODE_ENV === 'production';
esbuild
.build({
entryPoints: [
'./node_modules/monaco-editor/esm/vs/editor/editor.worker.js',
'./node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js',
path.join(SRC_PATH, 'umd/monaco.ts'),
path.join(SRC_PATH, 'umd/playground.ts'),
path.join(SRC_PATH, 'umd/sandbox.ts')
],
entryNames: '[name]',
outdir: BUILD_PATH,
bundle: true,
format: 'iife',
minify: isProduction,
loader: {
'.ttf': 'file'
},
watch: isProduction
? undefined
: {
onRebuild(error, result) {
if (error) console.error('watch build failed:', error);
else console.log('watch build succeeded:', result);
}
}
})
.then((result) => {
console.log(result);
if (!isProduction) {
console.log('UMD build is watching...');
}
});