-
Notifications
You must be signed in to change notification settings - Fork 1
/
compile.ts
41 lines (37 loc) · 1022 Bytes
/
compile.ts
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
import { build } from 'https://deno.land/x/esbuild@v0.12.25/mod.js';
import { httpImports } from 'https://deno.land/x/esbuild_plugin_http_imports@v1.1.3/index.ts'
import { emptyDir } from "https://deno.land/std@0.106.0/fs/mod.ts";
await emptyDir("./out")
build({
entryPoints: {
"main": "./src/main.ts",
},
platform: "browser",
target: "esnext",
format: "esm",
treeShaking: true,
external: [],
chunkNames: "chunks/[name]-[hash]",
splitting: true,
loader: {
".css": "file",
".wasm": "binary",
".fx": "text"
},
plugins: [
{
name: "close-on-complete",
setup(build) {
build.onEnd((result) => Deno.exit(result.errors.length >= 1 ? 1 : 0))
}
},
httpImports({
defaultToJavascriptIfNothingElseFound: true
})
],
bundle: true,
logLevel: 'debug',
outdir: "./out/",
minify: true
})
await Deno.copyFile("index.html", "./out/index.html")