Skip to content

V0/diegogenerali2 6931 8a1fe33f#429

Draft
cipollas wants to merge 2 commits intopi-apps:mainfrom
cipollas:v0/diegogenerali2-6931-8a1fe33f
Draft

V0/diegogenerali2 6931 8a1fe33f#429
cipollas wants to merge 2 commits intopi-apps:mainfrom
cipollas:v0/diegogenerali2-6931-8a1fe33f

Conversation

@cipollas
Copy link
Copy Markdown

@cipollas cipollas commented Apr 7, 2026

No description provided.

v0 bot and others added 2 commits April 7, 2026 14:20
Add vercel.json to set root directory for Next.js project.
…causing build failures due to missing dependencies like dotenv.

This commit fixes the issue reported at tsconfig.json:19

## Bug Explanation

The root `tsconfig.json` for the Next.js application uses the glob pattern `"include": ["**/*.ts", "**/*.tsx"]` which recursively includes all TypeScript files in the project directory. However, the `exclude` array only contained `"node_modules"`.

The repository contains three separate applications:
1. The root Next.js application (deployed to Vercel)
2. A separate Express backend in `backend/` with its own `package.json` and dependencies (including `dotenv`)
3. A separate Vite React frontend in `frontend/` with its own `package.json` and dependencies

When Next.js runs its build, it type-checks all files included in the tsconfig. Since `backend/src/environments.ts` imports `dotenv` but `dotenv` is not a dependency of the root Next.js project, the build fails with:
```
Type error: Cannot find module 'dotenv' or its corresponding type declarations.
```

This is a configuration issue where the root Next.js project's tsconfig inadvertently includes files from independent sub-projects that have different dependency graphs.

## Fix Explanation

The fix adds `"backend"` and `"frontend"` to the `exclude` array in `tsconfig.json`:
```json
"exclude": ["node_modules", "backend", "frontend"]
```

This ensures that the root Next.js project only type-checks its own TypeScript files and doesn't attempt to compile files from the separate backend and frontend applications. Each of those sub-projects has its own `tsconfig.json` for their respective builds.

After the fix:
- `pnpm exec tsc --noEmit` passes without errors
- `pnpm exec next build` completes successfully

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: cipollas <diegogenerali2@gmail.com>
@cipollas cipollas marked this pull request as draft April 7, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant