Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-workspaces-playground

> 前端框架
Open source

⚛️ Zero Config Create-React-App Monorepos with Yarn Workspaces, Lerna and React Storybook.

759 stars0 likes3 views
WebsiteGitHub

About

⚛️ Zero Config Create-React-App Monorepos with Yarn Workspaces, Lerna and React Storybook.

Now supports TypeScript and React-App-Rewired!

Features

  • ⚛️ Create React App 3 (React 16.8)
  • Storybook 5
  • Yarn Workspaces
  • Lerna 3
  • ✨ Host Multiple CRA Apps, Component Libraries & Storybooks in one Monorepo
  • Hot Reload all Apps, Components & Storybooks
  • ‍ Test all workspaces with Eslint & Jest using one command
  • :octocat: Deploy your apps to Github Pages using one command

Contents

  • Features
  • Contents
  • Setup
    • Pre-Requisites
    • Installation
  • Usage
    • Starting The React App
    • Starting The Storybook
    • Linting & Testing
    • Deploying to GitHub Pages
    • Creating a New CRA App
  • How Does It Work?

Setup

Pre-Requisites

  • Yarn 1.13.0
  • Node 11.14.0

Installation

bash
git clone [email protected]:react-workspaces/react-workspaces-playground.git
cd react-workspaces-playground
yarn

Adding workspace dependencies

bash
yarn workspace  

This will run the chosen Yarn command in the selected workspace.

Example:

bash
yarn workspace my-app add react-router-dom --dev

This will add react-router-dom as dependencies in your packages/my-app/package.json. To remove dependency use remove instead of add

Usage

Starting Project in Workspace

From your project root type start command for desired app

bash
yarn workspace @project/app-single-comp start

All available start scripts

json
"scripts": {
    "start:app-ant-design": "yarn workspace @project/app-ant-design-rewired start",
    "start:app-multi": "yarn workspace @project/app-multi-comps start",
    "start:app-single": "yarn workspace @project/app-single-comp start",
    "start:app-ts": "yarn workspace @project/app-typescript start",
    "start:storybook": "yarn workspace @project/storybook storybook",
    "start:storybook-ts": "yarn workspace @project/storybook-typescript storybook",
    ...
  }

Starting The Storybook

bash
yarn start:storybook

Linting & Testing

bash
yarn workspace  test

Deploying to GitHub Pages

Update the homepage URL in app-one/package.json to reflect your GitHub Pages URL.

json
{
  "name": "@project/app-single-comp",
  "private": true,
  "homepage": "https://react-workspaces.github.io/react-workspaces-playground",
  "scripts": {
    "deploy": "gh-pages -d build"
  }
}

Run the deploy script.

bash
yarn workspace  deploy

Creating a New CRA App

Use Create React App's --scripts-version flag to create a new React App with Yarn Workspaces support.

bash
create-react-app --scripts-version @react-workspaces/react-scripts my-app

To create new TS app use Create React App's --template flag with --scripts-version flag to create a new React App with Yarn Workspaces support and Typescript.

bash
npx create-react-app --scripts-version @react-workspaces/react-scripts --template typescript my-ts-app

How Does It Work?

React Workspaces Playground uses a custom version of react-scripts under the hood. The custom react-scripts is an NPM package to use in place of the react-scripts dependency that usually ships with Create React App. See: (@react-workspaces/react-scripts) on NPM.

Support for Yarn Workspaces was added by:

  1. Adding yarn-workspaces.js file to resolve workspaces modules.

  2. Updating the Webpack config:

    • Use main:src in package.json for loading development source code.

    • Use production or development settings based on your yarn workspaces settings in your /package.json:

      json
      {
        "workspaces": {
          "packages": ["packages/apps/*", "packages/components", "packages/storybook"],
          "production": true,
          "development": true,
          "package-entry": "main:src"
        }
      }

Minimal updates to the Webpack config were required.

Diff: webpack.config.js

…

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptcracreate-react-appmonoreporeact-scripts

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架