forked from imbytecat/fullstack-starter
perf(compile): 启用 bytecode + minify + inline sourcemap
- Bun 官方 bytecode caching:中型应用 startup ~2x(docs.bun.sh/docs/bundler/bytecode) - minify:减小 bytecode 体积,二进制仅 +2MB sourcemap - sourcemap inline:嵌入二进制,保证错误堆栈可读,并在 compile.ts 清理 bundler 残留的 *.js.map
This commit is contained in:
@@ -49,12 +49,18 @@ const main = async () => {
|
||||
entrypoints: [ENTRYPOINT],
|
||||
outdir: OUTDIR,
|
||||
compile: { outfile, target },
|
||||
minify: true,
|
||||
bytecode: true,
|
||||
sourcemap: 'inline',
|
||||
})
|
||||
|
||||
if (!result.success) {
|
||||
throw new Error(result.logs.map(String).join('\n'))
|
||||
}
|
||||
|
||||
// Bun bundler still writes *.js.map next to the binary even with inline sourcemap.
|
||||
await rm(`${OUTDIR}/${ENTRYPOINT.replace(/\.ts$/, '')}.js.map`, { force: true })
|
||||
|
||||
console.log(`✓ ${target} → ${OUTDIR}/${outfile}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user