Skip to content

Create react app and yarn workspaces without "eject"

Notifications You must be signed in to change notification settings

elv1n/cra-workspaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run create-react-app 3 with workspaces

npm version npm monthly downloads

All you have to do is create your app using create-react-app and install cra-workspaces.

⚠️ Please Note:

By doing this you're breaking the "guarantees" that CRA provides. That is to say you now "own" the configs. No support will be provided. Proceed with caution.

The goal of this package is to make a monorepo using yarn workspaces to share common code across a Create React App 2+ (CRA). It runs create-react-app with yarn workspaces without config files or using 'eject'

Getting started

1) Install cra-workspaces

$ yarn add cra-workspaces -D

2) 'Flip' the existing calls to react-scripts in npm scripts

  /* package.json */

  "scripts": {
-   "start": "react-scripts start",
+   "start": "cra-workspaces start",
-   "build": "react-scripts build",
+   "build": "cra-workspaces build",
}

3) Start the Dev Server

$ yarn start

4) Build your app

$ yarn build