Open david-mears-2 opened 4 months ago
Same issue, this is so lame :P
https://github.com/prisma/nuxt-prisma/blob/main/src/module.ts#L85 Also causes optimizeDepths to be totally rewritten.
This Module assumes more things like:
In current state, would not recommend using this module. (sorry for the bash, I know people work hard on this but it just isn't production worthy for my 2cents )
Hey @Harm-Nullix, thanks for reporting the issue.
I understand your frustration and appreciate your feedback. Could you provide a reproduction so I can better investigate the problem?
Regarding the assumptions you mentioned:
Experimental Settings: [main/src/module.ts#L74](https://github.com/prisma/nuxt-prisma/blob/main/src/module.ts?rgh-link- date=2024-08-09T08%3A43%3A09Z#L74) Frontend Exposure: [main/src/module.ts#L97](https://github.com/prisma/nuxt-prisma/blob/main/src/module.ts?rgh-link- date=2024-08-09T08%3A43%3A09Z#L97)
I appreciate you pointing these out. We’re planning further improvements, but these particular assumptions may not be directly related to the current issue. Could you create a separate issue for these points? This will help me address them more effectively.
Could you provide a reproduction so I can better investigate the problem?
Im sorry i dont mean to be rude or anything in that direction.
You need a reproduction to see that the module is overriding entire nuxt.options.vite.optimizeDeps
?
https://github.com/prisma/nuxt-prisma/blob/main/src/module.ts#L87-L89
If nuxt.options.vite.optimizeDeps
has any value before this module is set up it will get deleted.
If the user uses this key in their nuxt.config.ts it will get overridden.
You can either run .push or just throw defu at it
nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
include: ["@prisma/nuxt > @prisma/client"],
});
The assumption regarding the exposure to the runtimeConfig.
nuxt.options.runtimeConfig.public.prisma
exposes to the frontend.
nuxt.options.nitro.runtimeConfig.public.prisma
exposes only to server side.
Same issue. It doesn't seem to have been repaired.
Me too.I'm now using the author's method to solve this problem temporarily and it works.
Versions
Issue
Running the dev server works fine. Running
nuxt build
(vianpm run build
) when@prisma/nuxt
is listed in the modules innuxt.config.ts
deletes other nuxt modules fromnode_modules/@nuxt
, leading to errors such as:or '@nuxt/test-utils', etc: the first module that fails to be found depends on the order in which modules are listed in nuxt.config.ts.
Before running
npm run build
, the nuxt part of my node_modules looked like this:After running
npm run build
, which errored as above, the nuxt part of my node_modules looked like this:This uninstalled or deleted a lot of nuxt modules, such that for example trying to run
npm run build
immediately afterwards led to:The other modules listed in my
nuxt.config.ts
are:Possible workaround?
My workaround is to not use
@prisma/nuxt
.I found that I could run the build step and it did not delete nuxt modules, and I could still use prisma (at least, I could perform operations from within an api endpoint, as below) if I uninstalled
@prisma/nuxt
, omitted the module from nuxt.config.ts, and used 'usage option B' instead of the composable.