Home

Awesome

typescript-monorepo-next-example

<ComponentA>

🙉🙉 TypeScript Monorepo Sample
Required TypeScript@3 above

Create monorepo with next.js

Prerequisition

yarn

Create monorepo


$ mkdir typescript-monorepo && cd $_
$ yarn init -y -p
$ mkdir -p packages/app && cd $_
$ yarn init -y
$ yarn add -D typescript @types/react
$ yarn add next react react-dom @zeit/next-typescript
$ mkdir pages
$ touch pages/index.tsx next.config.js .babelrc.js tsconfig.json
$ cd ../.. # change root directory

Configure typescript monorepo

Create component

$ mkdir -p packages/component-a && cd $_
$ yarn init -y
$ yarn add -D typescript @types/react
$ yarn add react
$ touch index.tsx tsconfig.json
$ cd ../.. # change root directory
$ yarn
$ yarn build:packages # or yarn build:packages:watch
$ yarn start

Related