Avoid turbo circular dependency error while using npm run dev
in non-monorepo (polyrepo) setup
#8200
Replies: 2 comments
-
I'm facing a similar issue when using the root package as a published NPM package so my NPM workspaces has a workspace pointing to the root For now I removed the NPM scripts from the root package and documented to use the |
Beta Was this translation helpful? Give feedback.
-
I also just realized turbo engine, turborepo, and turbopack are for different implementations and I should probably just use turbopack via |
Beta Was this translation helpful? Give feedback.
-
This might be an anti-pattern, but I wanted to add Turbo to my NextJS application in a non-monorepo setup and have it run from
npm run dev
so I don't have to retrain the other contributors (and our CI).At first Turbo was complaining that I'd created a recursive loop:
× root task //#dev (turbo dev) looks like it invokes turbo and might cause a loop
To avoid this I added a conditional to my
package.json
dev
script to check if Turbo was executing it (by checking for the existince of theTURBO_HASH
environment variable) to runnext dev
if it was, and moved theturbo dev
call to adev:turbo
script since it appearsturbo dev
is parsing thedev
script text for the wordsturbo dev
to throw the above error.directory structure
package.json
:Now running
npm run dev
runs turbo! 🥳This pattern can be applied to
build
,start
,lint
, etc.Hope this helps someone else!
Beta Was this translation helpful? Give feedback.
All reactions