-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError: __dirname is not defined
in ES module scope when generating custom clients
#22827
Comments
ReferenceError: __dirname is not defined
in ES module scope when generating custom clients
Hi @danieltamas, I tried reproducing your issue. I assume the Prisma schemas you pasted above are different than the ones you had locally, as running
I've thus added the following as an example model to both schemas: model User {
id Int @id
email String @unique
name String?
} Besides this, I was not able to reproduce this issue. Can you please double check that your reproduction list is exhaustive? I've even tried to add two custom server entries: // ./server/api/cockroach.ts
import { PrismaClient } from '../../prisma/client/cockroach'
export default defineEventHandler((event) => {
const prisma = new PrismaClient()
return {
hello: 'cockroach'
}
}) // ./server/api/ams.ts
import { PrismaClient } from '../../prisma/client/ams'
export default defineEventHandler((event) => {
const prisma = new PrismaClient()
return {
hello: 'ams'
}
}) ![]() |
@jkomyno I just ran into this error. I've uploaded a reproduction repository https://github.com/floppy012-repros/nuxt-prisma |
Bump. Any update on this? |
I have reproduced this with https://github.com/floppy012-repros/nuxt-prisma. Observations:
|
Does anyone have a working example of prisma + qwikjs (non-edge)? |
Bug description
Using Nuxt and Vite with prisma. In dev mode, everything works as expected.
However, when building the above error is fatal and stops the build.
For the moment there is no workaround that works and want to understand
what are the options to fix this.
Inspecting the culprits it looks like the
__dirname
and__filename
usagesare present in the
prisma:engines
blocks.Example below:
How to reproduce
( nuxt: 3.9.3, nitro: 2.8.1, vite: 5.0.11 )
/prisma/
folder ie:/prisma/my_service.prisma
npx prisma generate --schema prisma/my_service.prisma
yarn build
Expected behavior
The app should build and start in the node environment
Prisma information
Client 1
Client 2
Environment & setup
[macos(Ventura 13.4), linux(Debian 12)]
[PostgreSQL, CockroachDB]
[20.0.9]
Prisma Version
The text was updated successfully, but these errors were encountered: