Pick a sub-path import
Problem. Keep the bundle small by importing only the modules an app needs.
Solution. Use the per-module entry points listed in package.json#exports. Avoid the /full bundle in production code.
ts
// ✅ Tree-shakes well
import { signal, computed } from '@bquery/bquery/reactive';
import { $ } from '@bquery/bquery/core';
// ❌ Pulls every module
import { signal as fullSignal } from '@bquery/bquery/full';For CDN / no-build setups, @bquery/bquery/full is fine — it is the documented all-in-one entry. For app bundles, prefer per-module imports.
Why it works
- Each module barrel re-exports only its public surface.
- Vite, Rollup, and esbuild tree-shake unused exports because the package declares
"sideEffects": falsefor pure modules. - The
bun run check:full-bundlescript in the repo guards type-level drift between/fulland the per-module entries.
Related
- Concepts — Bundle & tree-shaking
- Getting started — installation
package.jsonexportsis the source of truth for available sub-paths.