"매 source code 의 semantic 보존 + size 의 minimize". 매 whitespace/comment 제거 + identifier rename + dead code elimination + constant folding. 2026 의 esbuild/SWC/OXC 의 native-speed mainstream, Terser 의 max compression fallback.
import{minify}from'terser';constout=awaitminify(src,{compress:{passes:3,pure_getters:true,unsafe_arrows:true},mangle:{properties:{regex:/^_/}},// 매 only _-prefixed
format:{comments:false},sourceMap:{url:'app.js.map'},});
Vite production
// vite.config.ts
exportdefault{build:{minify:'esbuild',// or 'terser' for max
sourcemap:true,rollupOptions:{output:{manualChunks:{vendor:['react','react-dom']}},},},};
sentry-cli sourcemaps inject ./dist
sentry-cli sourcemaps upload --release "$VERSION" ./dist
# 매 production 에 .map 의 ship 의 X — Sentry 의 server-side 보관
DCE / pure annotation
// 매 tree shaker 에 hint
constheavyConst=/*#__PURE__*/buildHeavy();// 매 unused → bundle 에서 제거