prisma / nuxt-prisma

Prisma ORM integration for Nuxt
https://www.prisma.io/docs/orm/more/help-and-troubleshooting/help-articles/prisma-nuxt-module
29 stars 1 forks source link

rollup error #12

Open 1034935767 opened 1 week ago

1034935767 commented 1 week ago

I got this error, I know auto import by .nuxt\types\nitro-imports.d.ts const prismaD: typeof import('../../node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d')['default']. Maybe should not do this addServerScanDir(createResolver(import.meta.url).resolve("./runtime/server")); at module.ts.

=========================================

[09:20:53]  WARN  [plugin inject] node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse D:/Users/Z/Documents/Workspace/JavaScript/Nuxt/nuxt-demo1/node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include

t)

1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
           ^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;

============================================

bbhxwl commented 1 week ago

I can run it, but I cannot build it

bbhxwl commented 1 week ago

[error] Cannot find module '/drone/src/node_modules/vite/node_modules/rollup/parseAst' imported from /drone/src/node_modules/vite/dist/node/index.js

mueslirieger commented 5 days ago

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact. Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts. Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

bbhxwl commented 4 days ago

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact. Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts. Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

Indeed, I also have this module because I used @ nuxt/ui pro, which includes these.

bbhxwl commented 4 days ago

I'm also getting this error and I found that it's happening only when I also use the @nuxt/image module. Loading order of modules does not seem to make an impact. Here would be a minimal reproduction on StackBlitz https://stackblitz.com/edit/nuxt-starter-dybn1q?file=nuxt.config.ts. Getting Prisma working with Stackblitz made it neccessary for me to use this extension in Chromium based Browsers (personally using Arc).

Are you also using this module? @1034935767 @bbhxwl

But there is no problem with the operation, only a compilation error.

1034935767 commented 4 days ago

I think it doesn't matter with other modules. Just should not import prismaD.

pvlastaridis commented 4 days ago

I got this error, I know auto import by .nuxt\types\nitro-imports.d.ts const prismaD: typeof import('../../node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d')['default']. Maybe should not do this addServerScanDir(createResolver(import.meta.url).resolve("./runtime/server")); at module.ts.

=========================================

[09:20:53]  WARN  [plugin inject] node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts: rollup-plugin-inject: failed to parse D:/Users/Z/Documents/Workspace/JavaScript/Nuxt/nuxt-demo1/node_modules/.pnpm/@prisma+nuxt@0.0.30_nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20_rappjaaf4divnx3cq7ck24zofu/node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d.ts. Consider restricting the plugin to particular files via options.include

t)

1: import { PrismaClient } from "@prisma/client";
2: declare const prismaClientSingleton: () => PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, i...
           ^
3: declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client...
4: export type CustomPrismaClient = ReturnType<typeof prismaClientSingleton>;

============================================

Well spotted but how can we force it not to export { default as prismaD } from '../../node_modules/@prisma/nuxt/dist/runtime/server/utils/prisma.d';

bbhxwl commented 3 days ago

Do you have a solution?

mueslirieger commented 8 hours ago

I find it interesting that the application does work for you when running the dev server but compilation fails because in my project neither of those work @bbhxwl

bbhxwl commented 5 hours ago

I find it interesting that the application does work for you when running the dev server but compilation fails because in my project neither of those work @bbhxwl

Well, yes, it's strange that it can't be officially used, it can only be tested.

david-walter-naptics commented 3 hours ago

I experience the same error message as OP. In a basically empty new project. In my case there is also this behavior where the build fails but the code runs, meaning for example that it did the migrations into my postgresql db. My package.json is the following:

{
    "name": "nuxt-app",
    "private": true,
    "type": "module",
    "scripts": {
        "build": "nuxt build",
        "dev": "nuxt dev --dotenv .env.local",
        "generate": "nuxt generate",
        "preview": "nuxt preview",
        "postinstall": "nuxt prepare",
        "type-check": "npx nuxi typecheck",
        "lint": "eslint .",
        "start": "node .output/server/index.mjs"
    },
    "dependencies": {
        "@nuxt/eslint": "^0.3.13",
        "@nuxt/ui": "^2.17.0",
        "@nuxtjs/i18n": "^8.3.1",
        "@prisma/nuxt": "^0.0.30",
        "@sidebase/nuxt-auth": "^0.7.2",
        "nuxt": "^3.12.2"
    },
    "devDependencies": {
        "@prisma/client": "^5.16.1",
        "prisma": "^5.16.1",
        "typescript": "^5.5.2",
        "vue-tsc": "^2.0.22"
    }
}

I would love to run nuxt-prisma, it is by far the best solution for nuxt and postgresql.

bbhxwl commented 3 hours ago

I experience the same error message as OP. In a basically empty new project. In my case there is also this behavior where the build fails but the code runs, meaning for example that it did the migrations into my postgresql db. My package.json is the following:

{
    "name": "nuxt-app",
    "private": true,
    "type": "module",
    "scripts": {
        "build": "nuxt build",
        "dev": "nuxt dev --dotenv .env.local",
        "generate": "nuxt generate",
        "preview": "nuxt preview",
        "postinstall": "nuxt prepare",
        "type-check": "npx nuxi typecheck",
        "lint": "eslint .",
        "start": "node .output/server/index.mjs"
    },
    "dependencies": {
        "@nuxt/eslint": "^0.3.13",
        "@nuxt/ui": "^2.17.0",
        "@nuxtjs/i18n": "^8.3.1",
        "@prisma/nuxt": "^0.0.30",
        "@sidebase/nuxt-auth": "^0.7.2",
        "nuxt": "^3.12.2"
    },
    "devDependencies": {
        "@prisma/client": "^5.16.1",
        "prisma": "^5.16.1",
        "typescript": "^5.5.2",
        "vue-tsc": "^2.0.22"
    }
}

I would love to run nuxt-prisma, it is by far the best solution for nuxt and postgresql.

I also really want to use it, but unfortunately, let's wait for more people to discover this issue.