Next.js Discord

Discord Forum

Bun monorepo / next.js builds my backend project

Unanswered
Cane Corso posted this in #help-forum
Open in Discord
Cane CorsoOP
Hey! i have a monorepo with frontend (Next.js) and backend (Elysia.js), and i shared package that imports the Elysia App type from the backend and exports Eden treaty function.
Everything works until the frontend build:
cd apps/frontend -> bun run build, it starts the build and then fail because of the backend:
PS C:\Projects\x\apps\frontend> bun run build
$ next build
  ▲ Next.js 14.2.3
  - Environments: .env

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  ..Failed to compile.

../backend/routes/cs2/auth/index.ts:2:22
Type error: Cannot find module '~/utils/lib/jwt' or its corresponding type declarations.

  1 | import Elysia from 'elysia'
> 2 | import jtwSetup from '~/utils/lib/jwt'


why will it build the backend if i started the frontend build process? and I only import the App type from the backend to the shared package, and export a function that using this type?

0 Replies