Switch from parcel to esbuild (#432)

This commit is contained in:
Jamie Wong
2025-01-15 14:47:40 -08:00
committed by GitHub
parent 911feb609b
commit 103e441e27
16 changed files with 1706 additions and 11560 deletions

36
scripts/dev-server.ts Normal file
View File

@@ -0,0 +1,36 @@
import * as esbuild from 'esbuild'
import {buildOptions, generateIndexHtml} from './esbuild-shared'
async function main() {
const outdir = 'dist'
let ctx = await esbuild.context({
...buildOptions,
outdir,
write: false,
metafile: true,
plugins: [
{
name: 'speedscope-dev-server',
setup(build) {
build.onEnd(buildResult => {
generateIndexHtml({
buildResult,
outdir,
servingProtocol: 'http',
})
})
},
},
],
})
await ctx.rebuild()
let {host, port} = await ctx.serve({
servedir: outdir,
})
console.log(`Server is running at http://${host}:${port}`)
}
main()