A template and quick-starter kit for creating your own modern React library using Rollup.
This boilerplate leverages Rollup for bundling, providing a solid starting point for developing React component libraries.
- Bundling with Rollup for
commonjs
andes
module formats. - Testing with Jest and React Testing Library.
- Support for TypeScript for static type checking.
- Sourcemap generation for easier debugging.
- CSS/SASS support for styling components.
- Bundle size optimization with @rollup/plugin-terser.
- Automatic externalization of peerDependencies in the Rollup bundle using rollup-plugin-peer-deps-external.
- Code formatting and linting with ESLint & Prettier.
- Create a new repository using this template.
- Clone your repository.
- Enable
pnpm
(if not already enabled) and install dependencies withnpm install
.
For local development, run Rollup in watch mode to automatically recompile your src/
module into dist/
on file changes.
npm run dev
npm run build
: Builds the library to dist.npm run dev
: Builds the library and watches for changes.npm test
: Runs tests and displays coverage.npm run lint
: Lints your code.npm run prettier
: Formats your code with Prettier.
publish to npm Run:
npm publish
MIT.