Using recent vercel monorep support. (docs).
Two apps deployed:
Both uses packages relying on yarn workspaces and illustrate two methods to allow transpilation.
Two nextjs apps: apps/blog-app and the apps/web-app. Two shared packages: packages/bar and packages/foo.
.
├── apps
│ ├── blog-app (NextJS SSG app)
| | ├── src/
| | ├── next.config.js
| | ├── package.json
| | └── tsconfig.json (extends base config)
│ ├── web-app (NextJS app with api-routes)
| | ├── src/
| | ├── next.config.js
| | ├── package.json
| | └── tsconfig.json (extends base config)
├── packages
│ ├── bar (Shared with tsconfig path resolution, publishable with microbundle)
| | ├── src/
| | ├── package.json
| | └── tsconfig.json
│ ├── foo (Shared with next-transpile-modules)
| | ├── src/
| | ├── package.json
| | └── tsconfig.json
├── package.json (the workspace config)
└── tsconfig.json (base typescript config)
Declare your workspaces paths in package.json
For typescript config base path:
Create a base tsconfig.json at the root.
Set baseUrl to '.' and define your dependencies in paths.
Configure webpack in next.config.js
For next-transpile-module
Define your shared packages in your apps, i.e: next.config.js
Your shared packages have to indicate a main field (since next-transpile-modules v6), i.e:
package.json.
For deployments
Be sure you build as 'serverless' to benefit from vercel monorepo support.
When importing the repo, set the name of the app (i.e blog-app) and be sure to override development settings are like this:

@optional-package-scope/bar is shared through typescript baseUrl resolution improvements from #13542 (rather than next-transpile-module).
| Support matrix | tsconfig paths | next-transpile-module |
|---|---|---|
| Typescript | ✅ | ✅ |
| Javascript | ✅ | ✅ |
| NextJs Fast refresh | ✅ | ✅ |
| CSS | ❌ | ✅ |
| SCSS | ❌ | ✅ |
| CSS-in-JS | ✅ | ✅ |
| ts-jest | ✅ | ? |
| Vercel monorepo | ✅ | ✅ |
| Yarn 2 PNP | ✅ | ❌ |
| Experimental webpack5 | ? | ❌ (working on it) |
| Publishable (npm) | ✅ | ❌ (cause they rely on "main") |
resolveSymlinks that
can help. yarn deps:check)$ claude mcp add nextjs-monorepo-example \
-- python -m otcore.mcp_server <graph>