forked from bultas/monaco-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
47 lines (42 loc) · 1.01 KB
/
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
const esbuild = require("esbuild");
const path = require("path");
const outdir = path.join(__dirname, "dist", "monaco");
// const workerEntryPoints = [
// "vs/language/json/json.worker.js",
// "vs/language/css/css.worker.js",
// "vs/language/html/html.worker.js",
// "vs/language/typescript/ts.worker.js",
// "vs/editor/editor.worker.js",
// ];
// build({
// entryPoints: workerEntryPoints.map(
// (entry) => `./node_modules/monaco-editor/esm/${entry}`
// ),
// bundle: true,
// format: "iife",
// outbase: "./node_modules/monaco-editor/esm/",
// outdir: outdir,
// });
build({
entryPoints: ["index.js"],
bundle: true,
format: "esm",
outdir: outdir,
minify: true,
loader: {
".ttf": "file",
},
});
/**
* @param {import ('esbuild').BuildOptions} opts
*/
function build(opts) {
esbuild.build(opts).then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
});
}