-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathesbuild.mjs
More file actions
33 lines (29 loc) · 879 Bytes
/
esbuild.mjs
File metadata and controls
33 lines (29 loc) · 879 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
29
30
31
32
33
import * as esbuild from 'esbuild'
const watch = process.argv.includes('--watch')
const minify = process.argv.includes('--minify')
const error = process.argv.includes('--error')
const entryPoints = error
? ['app/assets/javascripts/error.js']
: [
'app/assets/javascripts/admin.js',
'app/assets/javascripts/application.js',
'app/assets/javascripts/archived-petitions.js',
'app/assets/javascripts/cookie-manager.js',
'app/assets/javascripts/character-counter.js',
'app/assets/javascripts/signature-form.js',
'app/assets/javascripts/open-petition.js'
]
const context = await esbuild.context({
entryPoints: entryPoints,
bundle: true,
sourcemap: !minify,
minify: minify,
outdir: 'app/assets/builds',
publicPath: 'assets'
});
if (watch) {
await context.watch()
} else {
await context.rebuild()
context.dispose()
}