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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-build-dist

v0.0.8

Published

A simple utility for compiling your React components to standalone modules.

Downloads

173

Readme

react-build-dist

A simple utility for compiling your React components to standalone modules.

Ideally, you should never need to touch Webpack and Babel if all you want to do is to make and publish React components.

The idea behind this tool is similar to React-Build-Lib, but since this tool deals with Webpack, it still does not work quite well. PRs and suggestions are welcome.

The Problem

Traditionally, in order to compile React components to standalone modules, you'll need to install and setup Webpack and Babel with the appropriate presets. This is a huge hassle if we want (React component) library authors to focus on creating their wonderful components.

We want library authors to never need to touch Webpack and Babel if all they want to do is make and share React components.

The Goal

Ideally, we want the following workflow for React component library authors:

  1. Install the package:
yarn add --dev react-build-dist
  1. Add a script to their package.json file:
"scripts": {
  "build:dist": "react-build-dist"
}
  1. Now, everytime npm run build:dist is run, Webpack will compile the user's React components from the src folder into a bundled javascript file inside the dist folder (along with a minified version) for standalone usage.

API

--bundle-name [filename]

Output bundle filename.

react-build-dist --bundle-name MyCoolComponent.js

--stage-0

Turn on stage-0 for experimental features.

react-build-dist --stage-0

--package-json [dirPath]

Path to package.json directory with react-build-dist config override.

We will try to guess your projects root directory, but depending on your installation configuration we might not be able to reliably find it. This param allows you to manually pass it in.

react-build-dist --package-json $(pwd)

Config Overrides

In your package.json you can override some of the default build settings. This is useful if your project uses more than just React as an external.

In your package json add a key of react-build-dist and you can override any of the following:

  • resolveLoader
  • entry
  • output
  • externals
  • module
  • plugins

Example:

  "react-build-dist": {
    "externals": {
      "react": "react",
      "react-dom": "react-dom"
    }
  }