Skip to content

Fails to resolve @prisma/client with Vite v6 #12610

Closed
@silvenon

Description

@silvenon

I'm using React Router as a...

framework

Reproduction

https://github.com/silvenon/repro/tree/react-router-v7-vite-v6-resolve-prisma-client

Clone the repository:

# if you have GitHub CLI installed run
gh repo clone silvenon/repro -- --branch react-router-v7-vite-v6-resolve-prisma-client
cd repro
# otherwise run
git clone https://github.com/silvenon/repro.git
cd repro
git switch react-router-v7-vite-v6-resolve-prisma-client

Install dependencies and set up Prisma:

npm run setup

The issue is present both in development and in build:

npm run dev
npm run build

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 297.69 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.1 - ~/.n/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.n/bin/npm
    pnpm: 9.15.1 - /opt/homebrew/bin/pnpm
    bun: 1.1.29 - ~/.bun/bin/bun
  Browsers:
    Chrome: 131.0.6778.205
    Edge: 131.0.2903.112
    Safari: 18.2
  npmPackages:
    @react-router/dev: ^7.1.0 => 7.1.0 
    @react-router/node: ^7.1.0 => 7.1.0 
    @react-router/serve: ^7.1.0 => 7.1.0 
    react-router: ^7.1.0 => 7.1.0 
    vite: ^6.0.5 => 6.0.5

Used Package Manager

npm

Expected Behavior

Expected to be able to upgrade to React Router v7.1.0 and to Vite v6, and have my app working as usual.

Actual Behavior

With Vite v6 it's failing to resolve @prisma/client both in dev and build.

Before v7.1.0 I had the same problem when I tried upgrading Vite to v6, so I was wondering what went wrong, but then I saw that you were still working on Vite v6 support so I assumed it was because of that, however unfortunately the problem remained.

I tried using Environment API to import @prisma/client in Vite v6 SSR without React Router involved, and it worked, so I think this has something to do with how React Router is using Vite.

[plugin:vite:import-analysis] Failed to resolve entry for package "@prisma/client". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "@prisma/client" package

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions