Local Package Linking
Link Cubitt packages locally to other projects like Mobius for development.
This guide explains how to develop Cubitt Components locally (inside the Cubitt monorepo) while having Mobius automatically use your local changes.
Cubitt uses Bun while Mobius uses pnpm. Since each package manager has its own link registry, we use path-based overrides instead of link commands.
Instructions
Add override in Mobius
Add a pnpm override to the Mobius root package.json:
{
"pnpm": {
"overrides": {
"@tilt-legal/cubitt-components": "link:../cubitt/packages/components"
}
}
}Then install:
cd ~/tilt-legal/mobius
pnpm installThis override forces every package in Mobius to use your local Cubitt Components package, even if they reference it via catalog:.
Enable live updates
Cubitt exports TypeScript source files during development. To get live updates without rebuilding, add Cubitt to the transpilePackages array in Mobius's Next.js config:
const nextConfig: NextConfig = {
transpilePackages: [
"@mobius/queries",
"@mobius/collections",
"@tilt-legal/cubitt-components", // Add for live updates
],
};This config can stay permanently. When Cubitt is installed normally (pre-built from npm), Next.js simply passes the compiled JS through without issue.
Run both in dev mode
Start Cubitt:
cd ~/tilt-legal/cubitt
turbo devStart Mobius:
cd ~/tilt-legal/mobius
turbo devWith transpilePackages configured, changes to Cubitt components will be picked up by Mobius automatically.
Verifying the link
Check resolution
pnpm why @tilt-legal/cubitt-componentsShould show:
link:../cubitt/packages/componentsInspect node_modules
ls -la node_modules/@tilt-legal/cubitt-componentsShould be a symlink pointing to your local Cubitt directory.
Removing the local link
To revert to the published npm version via catalog, remove the override from Mobius root package.json, then reinstall:
cd ~/tilt-legal/mobius
pnpm install