Import Styles & Tree-Shaking
Learn how to import utilities from sc-fns for optimal developer experience and zero bundle waste.
Import Strategies
sc-fns supports two flexible import patterns:
1. Subpath Imports (Recommended for Frontend Bundles)
Subpath imports allow bundlers (Vite, webpack, Rollup, Turbopack, esbuild) to only load the specific file for that namespace. This guarantees minimum bundle footprint and lightning-fast build resolution.
ts
2. Root Import (Convenient for Backend / Full-Stack)
You can also import any utility directly from the root package "sc-fns". Because all functions are marked as side-effect free, modern bundlers will automatically tree-shake unused exports in production builds:
ts
Package Exports Map
The package defines explicit Node.js export mappings in package.json:
json
Immutability Guarantee
All functions in sc-fns follow functional, non-mutating principles. Calling functions like shuffleArray(), chunkArray(), or omit() will never modify the original data passed in:
ts
How is this guide?
Last updated on October 25, 2026