npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

react-rollup-package-template

v0.1.0

Published

πŸš€ **A modern React library template** built with TypeScript, Rollup, and best practices for reusable components and libraries.

Readme

React Rollup Package Template

πŸš€ A modern React library template built with TypeScript, Rollup, and best practices for reusable components and libraries.


Features

  • ⚑ Rollup for optimized builds.
  • πŸ“¦ Outputs in CommonJS and ESModule formats.
  • πŸ”’ Built-in TypeScript support.

Getting Started

1. Clone the Template

git clone https://github.com/kawaljain/react-rollup-package-template.git
cd react-rollup-package-template

2. Install Dependencies

npm install

Development Workflow

Available Scripts

  • Build the Library
npm run build

Outputs both cjs and esm formats in the dist/ folder.

Folder Structure

react-library-template/
β”œβ”€β”€ src/                        # Source files for the library
β”‚   β”œβ”€β”€ components/             # Reusable React components
|   |   |──Dummy
β”‚   β”‚   |  └── Dummy.tsx        # Example Dummy component
β”‚   β”‚   |  └── Dummy.types.tsx  # Example Dummy component types
β”‚   β”‚   |  └── index.ts         # Dummy component entry point
β”‚   β”‚   |  └── style.css        # Contains css for dummy component
β”‚   |   β”œβ”€β”€ index.ts            # Component entry point
β”‚   β”œβ”€β”€ index.ts                # Library entry point
β”œβ”€β”€ dist/                       # Compiled output (generated after build)
β”œβ”€β”€ rollup.config.js            # Rollup configuration for building the library
β”œβ”€β”€ package.json                # NPM metadata and scripts
β”œβ”€β”€ README.md                   # Documentation for the library
β”œβ”€β”€ tsconfig.json               # TypeScript configuration file
β”œβ”€β”€ LICENSE                     # Open-source license file
└── .gitignore                  # Files and directories to be ignored by Git

Key Folders and Files

  • src/: Contains all source files, including components and utilities.
  • dist/: The build output folder (ignored in version control).
  • rollup.config.js: Rollup configuration file to bundle your library.
  • tsconfig.json: TypeScript configuration to enable strict typing and generate type declarations.
  • package.json: Defines project metadata, dependencies, and scripts.
  • .gitignore: Specifies files and folders to exclude from version control.

Key Folders and Files

rollup.config.js

  • Rollup is a module bundler used to create efficient and optimized builds of your library.
  • This file configures the input source (src/index.ts) and outputs (dist/ folder) in both CommonJS and ESModule formats.
  • It includes plugins like:
    • @rollup/plugin-node-resolve: Allows importing from node_modules.
    • @rollup/plugin-commonjs: Converts CommonJS modules to ESModules.
    • @rollup/plugin-typescript: Transpiles TypeScript files to JavaScript.
    • rollup-plugin-terser: Minifies the output for production.

src/

  • Contains all the source code for your library, including reusable components and utilities.
  • index.ts: Acts as the entry point for your library, exporting components and utilities.

dist/

  • Stores the compiled and bundled output, including:
    • CommonJS (.cjs.js): For Node.js environments.
    • ESModules (.esm.js): For modern JavaScript bundlers like Webpack or Vite.
    • Type Declarations (.d.ts): Generated by TypeScript for type safety.

Other Key Files

  • tsconfig.json: Configures TypeScript for strict typing and output generation.
  • package.json: Specifies the entry points for your library, dependencies, and useful scripts.
  • .gitignore: Prevents unnecessary files and folders like node_modules and dist/ from being committed to version control.

Why Use Rollup?

  • Tree-shaking: Removes unused code, ensuring your library is lightweight.
  • Multi-format Support: Builds libraries in both CommonJS and ESModule formats, ensuring compatibility across environments.
  • Plugin Ecosystem: Supports powerful plugins for TypeScript, minification, and resolving node modules.
  • Optimized for Libraries: Designed specifically to bundle libraries rather than full applications.

Publishing to NPM

  1. Update package.json:

    • Set the name, version, and description fields.
    • Ensure main and module point to dist/cjs/index.js and dist/esm/index.js.
  2. Log in to NPM:

npm login
  1. Publish your library::
npm publish --access public

Contributing

We welcome contributions! To contribute:

1. Fork the repository.

2. Create a new branch

git checkout -b feature/your-feature-name

3. Commit your changes

git commit -m "Add your feature"

3. Push to your branch and create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.