This repository shows a simple way to create a monorepo (where X applications can use a shared package - e.g. for shared UI, scripts, services, models or whatever).
The solution I built uses Yarn Workspaces, Yarn PnP and Node.js Corepack.
- Node.js 18+ (
v18.13.0) - Yarn
4.0.1(managed by corepack):$ npm uninstall -g yarn$ npm install -g corepack$ corepack enable
- install dependencies (generate
.pnp.cjsfile):
$ yarn- run compilation process for
sharedpackage (in watch mode):
$ yarn workspace shared watch # tsc --watch- run compilation process for
app1package (in watch mode):
$ yarn workspace app1 watch # tsc --watch- execute
app1output:
$ yarn workspace app1 node dist/src/index.js- production build instruction
- packages versioning