ReferenceError: __dirname is not defined in ES module scope
I am using Prisma Client with SvelteKit and I am getting this error on builds/preview. I have tried looking up solutions but I could not find a solution. I saw someone saying it should be fixed in Prisma 6.7. Is this true? This issue is preventing my application from working once it is built.
2 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai
for a quick spin!I have found a workaround to this. I replaced all occurrences of __dirname in the build directory with import.meta.url
However, this is a bandaid solution and I would appreciate if there was an official way of fixing this.