This is a simple monorepo template with some specific design goals:
- Latest TypeScript version
- Fast, incremental dependency updates and builds
- No package bundler
- Watch mode works
- ESM and CJS work (with distinct build outputs)
- Vanilla TS and React packages work
- Create React App works (with hot module reloading of the entire workspace)
- Node 16+
If you have Node 16+, you can activate PNPM with Corepack:
corepack enable corepack prepare [email protected]`npm info pnpm --json | jq -r .version` --activate
corepack prepare [email protected] --activate
git clone https://github.com/jordansexton/typescript-monorepo.git cd typescript-monorepo pnpm install
Run this to build all your workspace packages.
This will build workspace packages that use
tsc for compilation first, then everything else.
Run this to build and watch workspace packages that use
tsc for compilation.
Other packages can build and run with their own tools (like CRA's react-scripts commands).
Run (with HMR)
Run this in a separate terminal from the
cd packages/app/create-react-app pnpm start
Change the string
'Hello, world!' to some other string, and save the file. The CRA app should update automatically, reflecting this deeply nested change.