Next.js in a monorepo - parent dependency
Unanswered
Luke posted this in #help-forum
LukeOP
I'm trying to deploy a Next app which lives under
The
Unfortunately, if I change the Root Directory, it cannot access
Instead I have tried to use custom commands such as this...
This results in an error:
I didn't want to define
./demoThe
package.json of the ./demo app includes a dependency from ../, where is deployment is a demo of a package it is being published alongside. I want to keep the relative dependency, so preview deployments can be included with pre-releases of the package.Unfortunately, if I change the Root Directory, it cannot access
../.Instead I have tried to use custom commands such as this...
{
"buildCommand": "cd ./demo && npm run build"
}This results in an error:
Error: No Next.js version could be detected in your project. Make sure "next" is installed in "dependencies" or "devDependencies"I didn't want to define
next as a dev dependency of my tiny npm package for the sake of a deployment. Any tricks on how to do this, without an entirely custom vercel config for the install/build/output/functions, etc.9 Replies
LukeOP
Wondering whether this is a use for
turbo 🤔@Luke Wondering whether this is a use for `turbo` 🤔
Black carp
turbo would certainly help you to organize your monorepo. If you want not to use it, then you would need something like npm-link.LukeOP
I was reading about that. Oddly enough I've been looking at a repo called
usehooks-ts for inspiration as I am building custom contexts. I now see why they used TurboBlack carp
Btw, even with
turbo its recommended to have next as a local dependency, since you could have different versions across your different apps.LukeOP
Interesting
Do you have a link to read a little more about that?
Black carp
You can see the monorepo structure of
turbos example with NextJs: https://github.com/vercel/turbo/tree/main/examples/basicLukeOP
Thanks moy, really helpful ðŸ™
Highly recommended to use turborepo too, but if you just want a simple structure with a js package and a demo next app, I have an example here https://github.com/joulev/tailwind-dark-aware