Monorepo proof of concept using yarn workspaces with:
- Nextjs application
- External js library
- External jsx component library
- Typescript support (though not used)
- Successfully builds with jss styled components
- Root
/package.json
workspaces wildcard to reference evrything in the package directory/yarnrc.yml
- Next.js App
packages/web-app/packages.json
look at the dependenciespackages/web-app/next.config.js
turn onexternalDir
for hot module reloading stuff (experimental)packages/web-app/tsconfig.json
Nextjs tsconfig including pathingpackages/web-app/.bablerc
config that worked for me with Nextjs ssr log errorspackages/web-app/empty.ts
prevent the ts compiler from barking if you don't have any ts files
- Shared Js Utility Methods
packages/utils/package.json
- Shared React Components Library
packages/shared-ui-components/package.json
packages/shared-ui-components/index.js
I mention this, because when I tried to name this fileindex.jsx
the compiler would bark at me. However, the files I reference are .jsx files. Makes sense since this isn't jsx, but figured I'd mention it nonetheless.
- Set up scripts to run app commands from root. As of now, you need to cd into the
web-app
directory and run yarn commands directly in there.
Best to use latest version of yarn
run
yarn set version latest