TanStackT
TanStack10mo ago
17 replies
hurt-tomato

Prisma import fails in monorepo deployed on Vercel

Looking into deploying tanstack start from a Turborepo on Vercel.
I've got some issues import issues from the db package (prisma wrapper).

Basically, the generator client looks like this:
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["prismaSchemaFolder", "typedSql"]
  output          = "../../../../node_modules/@prisma-app/client"
}


My app.config.ts looks like this:
import { defineConfig } from '@tanstack/react-start/config';
import tsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
  server: {
    preset: 'vercel',
  },
  tsr: {
    appDirectory: 'src',
  },
  vite: {
    build: {
      rollupOptions: {
        external: ['@prisma-app/client'],
      }
    },
    define: {
      global: {},
    },
    plugins: [
      tsConfigPaths({
        projects: [
          './tsconfig.json',
          '../../packages/ui/tsconfig.json',
          '../../packages/auth/tsconfig.json',
        ],
      }),
    ],
  },
});


However, in the logs of the deployed version I'm getting the following error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@prisma-app/client' imported from
I specify this works as expected on local dev server.

Any clue why this is happening & what should I do.

I can provide more config info if needed.
Was this page helpful?