Fix dev-server and source maps

This commit is contained in:
Jamie Wong
2025-01-15 14:39:50 -08:00
parent ada85fd41e
commit 3e9275683e
2 changed files with 16 additions and 12 deletions
+15 -12
View File
@@ -8,20 +8,23 @@ async function main() {
outdir,
write: false,
metafile: true,
plugins: [
{
name: 'speedscope-dev-server',
setup(build) {
build.onEnd(buildResult => {
generateIndexHtml({
buildResult,
outdir,
servingProtocol: 'http',
})
})
},
},
],
})
// TODO(jlfwong): This only builds the index file once at the server boot. It
// would be nice to have this rebuild on demand, but I don't see an API
// available from esbuild that would let me intercept to do this.
//
// I could just build my own server to do this and call rebuild manually, but
// this is good enough for now.
let buildResult = await ctx.rebuild()
generateIndexHtml({
buildResult,
outdir,
servingProtocol: 'http',
})
await ctx.rebuild()
let {host, port} = await ctx.serve({
servedir: outdir,
+1
View File
@@ -17,6 +17,7 @@ export const buildOptions: esbuild.BuildOptions = {
entryNames: '[name]-[hash]',
chunkNames: '[name]-[hash]',
assetNames: '[name]-[hash]',
sourcemap: true,
bundle: true,
format: 'esm',
splitting: true,