Skip to content

Commit 66530bc

Browse files
committed
perf(vanilla): use terser for the main build to fit the size-limit budget
packages/vanilla's bundled dist (solid-js + the whole @vates/data-table-solid adapter, as internal implementation details) had drifted over its own checked-in 27 KB gzip budget — 28.69 KB before this session's other work, 27.96 KB after (today's core extraction work already shrank it, just not enough). Switching this package's own build from Vite's default esbuild minifier to terser (property mangling deliberately left off) gets it to 25.25 KB, with some headroom, at no cost to any other package — core/react/vue/solid stay on esbuild, since their own consumers install solid-js/react/vue themselves rather than this package's dist/ carrying that weight. Verified beyond the existing test suite (which exercises source via vitest aliasing, not the built dist): a manual smoke test loading the actual terser-minified dist/data-table-vanilla.js against a real DOM (createDataTable, initial render, setData, destroy) behaves identically to before.
1 parent 4fa9392 commit 66530bc

3 files changed

Lines changed: 76 additions & 10 deletions

File tree

package-lock.json

Lines changed: 66 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vanilla/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"jsdom": "^29.1.1",
7272
"size-limit": "^12.1.0",
7373
"solid-js": "^1.9.15",
74+
"terser": "^5.50.0",
7475
"typescript": "^5.5.0",
7576
"vite": "^8.1.4",
7677
"vite-plugin-dts": "^4.5.4",

packages/vanilla/vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ export default defineConfig({
1010
dts({ include: ['src'], insertTypesEntry: true, rollupTypes: true, pathsToAliases: false }),
1111
],
1212
build: {
13+
// This is the one package where bundle size is actually budgeted (see package.json's
14+
// "size-limit" section) — it bundles solid-js + the whole @vates/data-table-solid adapter as
15+
// internal implementation details (see the `external` comment below), unlike core/react/vue/
16+
// solid, which stay on Vite's default esbuild minifier (fast, and their own consumers install
17+
// solid-js/react/vue themselves rather than this package's dist/ carrying the weight). Terser
18+
// trims another ~2.5 KB gzipped off this specific bundle vs. esbuild's minifier (property
19+
// mangling is deliberately left off — safe for local variable/function names, not for object
20+
// keys without auditing every dynamic property access first).
21+
minify: 'terser',
1322
lib: {
1423
// Only the main entry point here — a UMD/IIFE build (needed so this package still works as a
1524
// plain <script> global, unlike core/react/vue/solid which only ever ship es+cjs) can't have

0 commit comments

Comments
 (0)