-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebBuild.mjs
More file actions
28 lines (27 loc) 路 782 Bytes
/
Copy pathwebBuild.mjs
File metadata and controls
28 lines (27 loc) 路 782 Bytes
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
import fs from "fs"
import esbuild from "esbuild"
import gzipPlugin from "@luncheon/esbuild-plugin-gzip"
esbuild.build({
entryPoints: ["__tmp__/index.js"],
minify: true,
bundle: true,
outfile: "dist-web/index.js",
globalName: "structVec",
platform: "browser",
write: false,
plugins: [
gzipPlugin({
brotli: true,
gzip: false,
onEnd: ({outputFiles}) => {
const [_, zippedFile] = outputFiles
const {path, contents} = zippedFile
if (!fs.existsSync("buildInfo")) {
fs.mkdirSync("buildInfo")
}
fs.writeFileSync("buildInfo/index.js.br", contents)
fs.rmSync(path)
}
})
]
})