[grade=B] DC-072: Enable source maps in production esbuild bundles
Add sourcemap: 'both' to esbuild.transform — emits inline + external .map files for production debugging. Stack traces now point to real source lines. DC-090: Already resolved — Dockerfile pins node:20.11.1-alpine3.19 (specific).
This commit is contained in:
+6
-1
@@ -149,13 +149,18 @@ async function build() {
|
||||
const concatenated = parts.join(';\n');
|
||||
|
||||
// Minify with esbuild (safe to re-minify already-minified code like driver.min.js)
|
||||
const { code } = await esbuild.transform(concatenated, {
|
||||
// DC-072: sourcemap='both' emits inline + external .map for production debugging
|
||||
const { code, map } = await esbuild.transform(concatenated, {
|
||||
minify: true,
|
||||
target: 'es2020',
|
||||
sourcemap: 'both',
|
||||
});
|
||||
|
||||
const outPath = path.join(DIST, outName);
|
||||
fs.writeFileSync(outPath, code);
|
||||
if (map) {
|
||||
fs.writeFileSync(outPath + '.map', map);
|
||||
}
|
||||
|
||||
const rawSize = (Buffer.byteLength(concatenated) / 1024).toFixed(1);
|
||||
const minSize = (Buffer.byteLength(code) / 1024).toFixed(1);
|
||||
|
||||
Reference in New Issue
Block a user