Skip to main content

SitecoreAI · Tutorial

Installing Packages in a Turborepo Monorepo

How to install a dependency into every workspace or just one app, and why the quick start script skips the search index rebuild.

GavAusWeb2 min read

One habit to unlearn moving into a Turborepo-based XMC project: npm install at the root doesn't automatically mean 'available everywhere' the way it might in a single-app repo.

Install into every workspaceLink to this section

To add a package across every workspace/app in the monorepo, install it with the --workspaces flag. This installs it into each workspace rather than just the root:

bash
npm install -D file-loader --workspaces

Install into a single appLink to this section

If a dependency is only needed by one app (say, a specific rendering host), install it scoped to that workspace instead of blasting it everywhere. It keeps dependency graphs cleaner and makes build caching in Turborepo more effective:

bash
npm install package1 package2 -w @scope/app

Why up-quick.ps1 skips the index rebuildLink to this section

Rebuilding the search index locally is part of the regular up.ps1 startup script, but it was deliberately pulled out of up-quick.ps1. Running an index rebuild on every single startup adds real time to your morning boot-up, and you don't need a fresh index every time you're just picking up front-end work.