prisma / nuxt-prisma

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

Abysmally slow `nuxt dev` on NixOS #39

Open auctumnus opened 1 month ago

auctumnus commented 1 month ago

Hi!

I tried to set up Prisma with Nuxt, but it appears to cause nuxt dev to be abysmally slow, even if it's not actually enabled as a module.

Fresh Nuxt project (808ms):

nuxt dev server takes 808ms to start

With "@prisma/nuxt": "^0.0.35" in dependencies and "@prisma/client": "^5.19.1", "prisma": "^5.19.1" in devDependencies (100203 ms, or nearly 2 minutes):

nuxt dev server takes nearly 2 minutes to start

This is the flake.nix I'm using in both:

{
  inputs.pkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  inputs.prisma-utils.url = "github:VanCoding/nix-prisma-utils";

  outputs =
    { pkgs, prisma-utils, ... }:
    let
      nixpkgs = import pkgs { system = "x86_64-linux"; };
      prisma =
        (prisma-utils.lib.prisma-factory {
          inherit nixpkgs;
          prisma-fmt-hash = "sha256-Lj0V8E9a+q6+PvCF2ARRs34n1Ls3vySVmtN1rxfltRg=";
          query-engine-hash = "sha256-1BwohGMohcS0rQkrbD+4ne63NOtlZnxLfYUEMrnbglg=";
          libquery-engine-hash = "sha256-WWE2c5Xjw+7wbeGcdX6UU8YzPeT1vZQxye/Mh8XFsCA=";
          schema-engine-hash = "sha256-y5zt3jlaIBoxNHcDitOkMfLd/5doCadVmUiE4bAM/MA=";
        }).fromNpmLock
          ./package-lock.json;
    in
    {
      devShells.x86_64-linux.default = nixpkgs.mkShell {
        buildInputs = with nixpkgs; [
          nodejs_22
          nodePackages_latest.prisma
          openssl_3_3
        ];
        shellHook = prisma.shellHook;
      };
    };
}

Is there anything else I can do to help debug this issue?

Dzyanino commented 2 weeks ago

Hey there

I also got the same issue but using Archlinux It launched fine at first but after some time (I can't understand how) it started to take like 294893.35ms to setup Here is the output

> nuxt dev

Nuxt 3.13.2 with Nitro 2.9.7                                                                                                                                                    2:17:06 PM
                                                                                                                                                                                2:17:08 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using default Tailwind CSS file                                                                                                                             nuxt:tailwindcss 2:17:14 PM
✔ Prisma CLI is already installed.                                                                                                                                             2:18:30 PM
✔ Prisma schema file exists.                                                                                                                                                   2:18:30 PM
✔ Database migrations folder exists.                                                                                                                                           2:18:30 PM
                                                                                                                                                                                2:18:30 PM
Not migrating the database.
Generating Prisma client...

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.20.0) to ./node_modules/@prisma/client in 135ms

✔ Do you want to view and edit your data by installing Prisma Studio in Nuxt DevTools? … yes
Starting Prisma Studio...                                                                                                                                                       2:21:30 PM

✔ Prisma Studio installed.                                                                                                                                                     2:21:30 PM
After clicking Get Started in Nuxt DevTools, click on the three dots (︙) in the lower left-hand side to reveal additional tabs.
Locate the Prisma logo to open Prisma Studio.

 WARN  Slow module @prisma/nuxt took 294893.35ms to setup.                                                                                                                      2:21:30 PM

  ➜ DevTools: press Shift + Alt + D in the browser (v1.4.2)
ankur-arch commented 1 week ago

Hey there @auctumnus , can you set the export variable and see which step is taking up most of your time? Also the same @Dzyanino.