Skip to content

v6.5.0

Choose a tag to compare

@childrentime childrentime released this 05 Aug 11:59
· 61 commits to main since this release

πŸ“¦ 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

  • require entries now resolve to ./dist/index.js / ./dist/index.d.ts (previously .cjs / .d.cts); ./useQRCode moved to ./dist/useQRCode/index.*. Both were only reachable through the exports map, so consumers are unaffected.
  • Build tool switched from bunchee to tsdown; bunchee dropped from the root workspace.

Full PR: #216