🧪 Jest Compatibility & Export Improvements
Fixed
- 🔧 Jest Compatibility: Added CommonJS build alongside ESM for seamless Jest/testing integration
- 📦 Dual Module Export: Package now provides both ESM (
index.js) and CJS (index.cjs) formats - ✅ Zero Configuration: Works out-of-the-box with Jest in Next.js 16+, Create React App, and other environments
- 🎯 Clean Exports: Removed mixed named/default exports warning for better consumer experience
Changed
- Build Output: Now generates both
dist/index.js(18.88 kB ESM) anddist/index.cjs(12.76 kB CJS) - Package Exports: Updated
package.jsonwith proper dual module export configuration - Export Pattern: Adopted named-only export pattern (modern best practice)
Technical Details
This release resolves cannot find module errors when running Jest tests in Next.js and other environments. The package now automatically works with both ESM and CommonJS module systems without requiring any consumer configuration.
Installation
npm install @dev-ahmed-mahmoud/react-custom-scrollbarsUsage
import { Scrollbars } from '@dev-ahmed-mahmoud/react-custom-scrollbars'
function App() {
return (
<Scrollbars style={{ height: 300 }}>
<div>Your content here</div>
</Scrollbars>
)
}Package Links
Full Changelog: v5.0.1...v5.0.2