-
Notifications
You must be signed in to change notification settings - Fork 373
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
"__dirname is not defined in ES module scope" when running "solid-start start" #398
Comments
Actually it's caused by Prisma being a CJS dependency. You can solve it by externalizing it, like this: https://github.com/pawelblaszczyk5/planotes/blob/4b24f1d74735856bc438ba72c4ac036e9d198a73/apps/web/vite.config.ts#L8 |
@pawelblaszczyk5 what if our Prisma client is in another folder in a monorepo? This is only what worked for me: import { createRequire } from "module"
const require = createRequire(import.meta.url)
const { PrismaClient } = require("../../../prisma/prisma-client/index.js") But then we don't get type safety |
@huzaifahj @pawelblaszczyk5 Here is the type-safe solution I came up with.
|
When I attempt to run "npm start" in my solid-start project, I get the following error:
The text was updated successfully, but these errors were encountered: