Skip to content

Commit 106b293

Browse files
authored
Enable minification for production builds (#738)
Enabling minification reduces bundle size significantly while maintaining full debugging capability through source maps. Size reductions (what consumers download over network): 📦 STANDARD BUILD ES Module: Raw: 2,299 KB → 1,714 KB (25.4% reduction) Gzipped: 486 KB → 423 KB (12.9% reduction) UMD Module: Raw: 2,425 KB → 1,361 KB (43.8% reduction) Gzipped: 492 KB → 384 KB (21.9% reduction) 📦 BUNDLED BUILD (with styled-components) ES Module: Raw: 2,361 KB → 1,767 KB (25.1% reduction) Gzipped: 506 KB → 441 KB (12.7% reduction) UMD Module: Raw: 2,487 KB → 1,400 KB (43.7% reduction) Gzipped: 511 KB → 400 KB (21.8% reduction) Average: 34.5% reduction (raw), 17.3% reduction (gzipped) Background: - minify: false was added in March 2024 (PR #371) to aid debugging - sourcemap: true was added in July 2024 (PR #644) to improve stack traces - With source maps enabled, minification no longer affects debugging experience Benefits: - Smaller bundle size for faster downloads and better CDN caching - Source maps still provide full TypeScript source-level debugging - Follows industry standard (React, Material-UI, etc. all ship minified) - Browsers load source maps on-demand only when devtools are open Consumer Impact: - Consumers download 60-111 KB less per bundle (gzipped) - No loss of debugging capability - stack traces show original TypeScript - DevTools display original source code, not minified code
1 parent e39e128 commit 106b293

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (!isBundledBuild) {
2626
const buildOptions: BuildOptions = {
2727
target: 'baseline-widely-available',
2828
emptyOutDir: false,
29-
minify: false,
29+
minify: true,
3030
lib: {
3131
entry: resolve(__dirname, "src/index.ts"),
3232
name: "click-ui",

0 commit comments

Comments
 (0)