-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathesbuild-extension.mjs
More file actions
33 lines (31 loc) · 1006 Bytes
/
Copy pathesbuild-extension.mjs
File metadata and controls
33 lines (31 loc) · 1006 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 esbuild from 'esbuild'
const optionWatch = process.argv.slice(2).includes('--watch')
esbuild
.build({
entryPoints: [
'src/extension.ts'
],
platform: 'node',
format: 'cjs',
outfile: 'out/extension.js',
external: [
'vscode',
],
bundle: true,
minify: false,
splitting: false,
sourcemap: 'inline',
metafile: true,
watch: (optionWatch ? {
onRebuild(error, result) {
console.log('[watch] build started')
if (error) {
error.errors.forEach(error => console.error(`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}`))
} else {
console.log('[watch] build finished')
}
},
} : false),
})
.then(() => optionWatch && console.log('[watch] build finished'))
.catch(() => process.exit(1))