-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathesbuild.config.js
48 lines (44 loc) · 1.01 KB
/
esbuild.config.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
import { context as _context, build as _build } from 'esbuild';
import manifestPlugin from 'esbuild-plugin-manifest';
if (process.argv.includes("--dev")) {
_context({
outdir: "src/build",
entryPoints: [
"src/js/plutonium.js"
],
plugins: [
manifestPlugin({
filename: `js.manifest`,
shortNames: true,
})
],
bundle: true,
}).then((context) => context.watch().catch((e) => console.error(e.message)))
}
else {
function build(minify) {
const outExtension = minify ? { '.js': '.min.js' } : { '.js': '.js' }
_build({
outdir: "src/dist/js",
entryPoints: [
"src/js/plutonium.js",
],
minify,
sourcemap: true,
bundle: true,
outExtension
}).catch(() => process.exit(1));
_build({
outdir: "app/assets",
entryPoints: [
"src/js/plutonium.js"
],
minify,
sourcemap: true,
bundle: true,
outExtension
}).catch(() => process.exit(1));
}
build(true)
build(false)
}