I have a monorepo setup that shares code between a Next.js 13.3 app directory app and another app via a packages/shared workspace which I include via import { LookupOptions, cleanupUrl } from '@doesithaveafeed/shared'; and a "@doesithaveafeed/shared": "workspace:*", dependency.
Locally everything works fine. I can even run the next build process locally without a problem. However, when I deploy to Vercel, it looks like the build process there is trying to resolve @doesithaveafeed/shared as a package on a registry rather than use the local one in the monorepo and it fails.
Detected Next.js version: 13.3.0
Running "pnpm run build"
> @doesithaveafeed/[email protected] build /vercel/path0/apps/site
> next build
warn - You have enabled experimental feature (appDir) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
info - Creating an optimized production build...
Failed to compile.
./src/hooks/useFeedCheck.ts
Module not found: Can't resolve '@doesithaveafeed/shared'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./src/components/LookupForm.tsx
./src/app/api/check/route.ts
Module not found: Can't resolve '@doesithaveafeed/shared'
https://nextjs.org/docs/messages/module-not-found
> Build failed because of webpack errors
ELIFECYCLE Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1
BUILD_UTILS_SPAWN_1: Command "pnpm run build" exited with 1
How would I go about telling it to use the local workspace?
I have the Root Directory set up as apps/site and 'Include source files outside of the Root Directory in the Build Step.' is selected too.
Code here: https://github.com/jschuur/doesithaveafeed.com/tree/main/apps/site
Find out if or when a website has an RSS (or Atom) syndication feed. - doesithaveafeed.com/apps/site at main · jschuur/doesithaveafeed.com