v6.5.0
π¦ Build
Per-module dist: optimizePackageImports now works β #216
The published dist previously inlined all 120+ hooks into a single bundle, so barrel-file optimizers had nothing to unroll: a Next.js (Turbopack) dev page importing just useDebounce pulled in every hook β a 552 kB client chunk. The build now ships one file per module (tsdown with unbundle, i.e. preserveModules) with the entry as a thin barrel of re-exports, and the same page loads only useDebounce and its real dependency chain: 64 kB (β88%).
With this release, Next.js users can enable:
// next.config.js
module.exports = {
experimental: {
optimizePackageImports: ['@reactuses/core']
}
}β¨ Direct subpath imports
Every hook is now importable directly, skipping the barrel entirely β no bundler configuration needed:
import { useDebounce } from '@reactuses/core/useDebounce'Notes
requireentries now resolve to./dist/index.js/./dist/index.d.ts(previously.cjs/.d.cts);./useQRCodemoved to./dist/useQRCode/index.*. Both were only reachable through theexportsmap, so consumers are unaffected.- Build tool switched from bunchee to tsdown; bunchee dropped from the root workspace.
Full PR: #216