Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions assets/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ let opts = {
target: 'es2016',
outdir: '../dist/js',
define: {
'process.env.LATENCY_SIM': process.env.LATENCY_SIM || 0,
'process.env.LATENCY_SIM': process.env.LATENCY_SIM || "0",
},
}
if (mode === 'watch') {
opts = {
watch: true,
sourcemap: 'inline',
...opts
}
Expand All @@ -35,13 +34,13 @@ if (mode === 'release') {
}
}

// Start esbuild with previously defined options
// Stop the watcher when STDIN gets closed (no zombies please!)
esbuild.build(opts).then((result) => {
;(async () => {
const context = await esbuild.context(opts)

if (mode === 'watch') {
process.stdin.pipe(process.stdout)
process.stdin.on('end', () => { result.stop() })
context.watch()
} else {
await context.rebuild()
context.dispose()
}
}).catch((error) => {
process.exit(1)
})
})()
Loading
Loading