Skip to content

Commit 2d97555

Browse files
committed
perf: reduce @hanzo/ui bundle 74% by removing duplicate entries and enabling minification
- Remove duplicate tsup entries: primitives-export and primitives/index both compiled same primitives/index-standard.ts → save 2×436K=870K - Enable minify:true; safe because 'use client' banner is added post-build via onSuccess hook, not as source directive - Update ./primitives export in package.json to point to ./dist/index.mjs - Result: dist 10M → 2.6M, index.mjs 436K → 314K (minified) Published as @hanzo/ui@5.3.36
1 parent 7a7a36f commit 2d97555

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pkg/ui/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hanzo/ui",
3-
"version": "5.3.35",
3+
"version": "5.3.36",
44
"description": "Multi-framework UI library with React, Vue, Svelte, and React Native support. Based on shadcn/ui with comprehensive framework coverage.",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org/",
@@ -349,9 +349,9 @@
349349
"require": "./dist/components/*.js"
350350
},
351351
"./primitives": {
352-
"types": "./dist/primitives-export.d.ts",
353-
"import": "./dist/primitives-export.mjs",
354-
"require": "./dist/primitives-export.js"
352+
"types": "./dist/index.d.ts",
353+
"import": "./dist/index.mjs",
354+
"require": "./dist/index.js"
355355
},
356356
"./primitives/*": {
357357
"types": "./dist/primitives/*.d.ts",

pkg/ui/tsup.config.minimal.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ export default defineConfig({
8181
'input-otp': 'primitives/input-otp.tsx',
8282
'resizable': 'primitives/resizable.tsx',
8383

84-
// Re-exports for package compatibility
85-
'primitives-export': 'primitives/index-standard.ts',
86-
'primitives/index': 'primitives/index-standard.ts',
84+
// Utilities
8785
'util/index': 'util/index-client.ts',
8886
'lib/utils': 'src/utils.ts',
8987

@@ -227,7 +225,7 @@ export default defineConfig({
227225
target: 'es2020',
228226
outDir: 'dist',
229227
treeshake: true,
230-
minify: false, // Disabled to preserve 'use client' banner
228+
minify: true, // Safe: 'use client' banner added post-build in onSuccess
231229
esbuildOptions(options) {
232230
options.jsx = 'automatic'
233231
options.platform = 'neutral'

0 commit comments

Comments
 (0)