Error resolving module specifier “.prisma/client/index-browser”.
See original GitHub issueDescribe the bug
I have the following error message in my browser upon using sveltekit (adaptor-node) and the command “npm run preview”:
Uncaught TypeError: Error resolving module specifier “.prisma/client/index-browser”. Relative module specifiers must start with “./”, “../” or “/”.
It references a piece of code that was compiled with “npm run build” in localhost:3000/_app/start-b07b1607.js:
...s-d1fb5791.js";import".prisma/client/index-browser";let Be="",et="";function ...
However, it is unclear why this piece of code was inserted by npm run build. Is there a way to remove it?
Reproduction
I have tried reproducing this error with using older versions of Prisma, the adaptor and Svelte, switching from pnpm to npm, but nothing helps. I have a MWE repository that comes close to reproducing the error but doesn’t actually reproduce it at https://github.com/wvhulle/prisma-sveltekit-bug-report.
Logs
`Uncaught TypeError: Error resolving module specifier “.prisma/client/index-browser”. Relative module specifiers must start with “./”, “../” or “/”.`
System Info
System:
OS: Linux 5.14 Linux Mint 20.3 (Una)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 4.41 GB / 15.37 GB
Container: Yes
Shell: 3.4.0 - /usr/bin/fish
Binaries:
Node: 17.8.0 - /usr/bin/node
npm: 8.5.5 - /usr/bin/npm
Browsers:
Chromium: 99.0.4844.82
Firefox: 98.0.2
npmPackages:
@sveltejs/adapter-node: next => 1.0.0-next.73
@sveltejs/kit: next => 1.0.0-next.303
svelte: ^3.46.4 => 3.46.4
Severity
blocking all usage of SvelteKit
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
Closing as there’s nothing we can do here - vite doesn’t support enums, because esbuild doesn’t. Libraries generally shouldn’t be distributing code with enums IMHO
this is not an
enumissue,node_modules/.prismacontains generated js files.index.jsandindex-browser.jsdoesn’t have real enums, they only have objects mapping the enums.My not too elegant solution: https://github.com/prisma/prisma/issues/12504#issuecomment-1136126199