-
Notifications
You must be signed in to change notification settings - Fork 395
Open
Description
Fix module resolution errors for @v1 packages in Vercel deployment
Issue Description
Build is failing during Vercel deployment for the backend application (/apps/app
). The frontend (/apps/web
) deploys successfully.
Project Structure
- Single git repository with two deployment destinations:
/apps/web
- Frontend (port 3001)/apps/app
- Backend (port 3000)
- Using default build and development settings on Vercel
- No active configuration overrides
Deployment Configuration
Backend (/apps/app
) vercel.json:
?
Critical Information
-
Build Process:
- Uses pnpm for package management
- Requires navigation to root directory for installation
- Returns to app directory for build
- Uses Next.js framework settings
- Outputs to
.next
directory
-
Package Resolution:
- Monorepo structure with shared packages in
/packages
- Workspace dependencies managed by pnpm
- Module imports using
@v1
namespace
- Monorepo structure with shared packages in
-
Error Details
Backend build fails with multiple module resolution errors: -
In
./src/app/[locale]/layout.tsx
:- Cannot resolve
@v1/ui/globals.css
- Cannot resolve
@v1/ui/cn
- Cannot resolve
-
In
./src/components/google-signin.tsx
:- Cannot resolve
@v1/supabase/client
- Cannot resolve
Root Cause
The @v1 packages are not properly configured in the monorepo setup for Vercel deployment. While these packages work in local development, they fail during Vercel's build process.
Environment Details
- Deployment Platform: Vercel
- Package Manager: pnpm
- Framework: Next.js
- Development Ports:
- Frontend: 3001
- Backend: 3000
Steps to Reproduce
- Push changes to repository
- Vercel automatically triggers deployment
- Frontend (
/apps/web
) builds successfully - Backend (
/apps/app
) build fails with module resolution errors
Proposed Solution
- Verify package.json configurations:
- Check workspace dependencies
- Ensure proper package exports
- Verify Vercel's monorepo support settings
- Update tsconfig paths:
- Add proper path aliases for @v1 packages
- Verify build configuration:
- Check webpack/next.js module resolution settings
- Ensure Vercel is properly configured for monorepo builds
- Consider Vercel-specific adjustments:
- Verify monorepo project settings in Vercel dashboard
- Check if root directory setting needs adjustment
- Validate build command traversal
Impact
- Blocking backend deployment
- Frontend remains operational
- Affecting core functionality (auth, styling)
Priority
High - blocking backend deployment pipeline
Additional Notes
- The build command includes directory traversal (
cd ../..
) which might affect module resolution - The frontend deployment succeeds without a specific vercel.json, using default settings
- Package resolution might be affected by the build command's directory changes
Labels
- bug
- build
- vercel
- monorepo
Metadata
Metadata
Assignees
Labels
No labels