Proof of concept of a monorepo with yarn workspace/lerna/react CRA
In this repository, I tried to set up a monorepo to use React
CRA with shared
components and a storybook.
Currently, an issue is opened oncreate-react-app
I hope that it will be closed one the day.
Using Create React App
is the
best way to follow react update and keep compatibility with new features without
strong knowledge for webpack.
In this repo, I tried to touch the CRA config as little as possible.
I know that there is another possibility with
@react-workspaces/react-scripts"">@react-workspaces/react-scripts
the problem is that I don’t know what is done inside it and how close to CRA it
is so I prefer to custom a little bit CRA configuration.
With lerna, I add dependencies to common
in my-app
that allow requiring
files from common
.
I use craco
withget-yarn-workspace
to override CRA configuration and add others repositories to babel-loader
incraco-config.js
.
I do the same thing that with CRA, storybook has functions to overrides CRA configuration.
Install dependencies:
$ yarn install
Start applications:
$ yarn lerna run start
See app:
http://localhost:3000
http://localhost:9009
Build applications
$ yarn lerna run build