Skip to content

feat(client-generator-ts): always use ".wasm?module" import on edge runtimes (vercel-edge. workerd)#27953

Merged
jkomyno merged 1 commit intomainfrom
feat/prisma-client-edge-always-use-module-import-wasm
Aug 22, 2025
Merged

feat(client-generator-ts): always use ".wasm?module" import on edge runtimes (vercel-edge. workerd)#27953
jkomyno merged 1 commit intomainfrom
feat/prisma-client-edge-always-use-module-import-wasm

Conversation

@jkomyno
Copy link
Copy Markdown
Contributor

@jkomyno jkomyno commented Aug 21, 2025

This PR:

@jkomyno jkomyno added this to the 6.15.0 milestone Aug 21, 2025
@jkomyno jkomyno marked this pull request as ready for review August 21, 2025 20:46
@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
packages/client/runtime/library.js 403.88 KB (0%)
packages/client/runtime/library.d.ts 81 B (0%)
packages/client/runtime/binary.js 1.27 MB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 339.94 KB (0%)
packages/client/runtime/edge-esm.js 338.58 KB (-0.01% 🔽)
packages/client/runtime/wasm-engine-edge.js 284.34 KB (0%)
packages/client/runtime/index-browser.js 67.74 KB (0%)
packages/client/runtime/index-browser.d.ts 89 B (0%)
packages/cli/build/index.js 2.7 MB (-0.01% 🔽)
packages/client/prisma-client-0.0.0.tgz 25.93 MB (+0.01% 🔺)
packages/cli/prisma-0.0.0.tgz 16.63 MB (-0.01% 🔽)
packages/bundle-size/da-workers-libsql/output.tgz 951.27 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 1 MB (0%)
packages/bundle-size/da-workers-pg/output.tgz 1.01 MB (0%)
packages/bundle-size/da-workers-planetscale/output.tgz 969.89 KB (0%)
packages/bundle-size/da-workers-d1/output.tgz 935.46 KB (0%)

@tobiasdiez
Copy link
Copy Markdown

Would it be possible to have a toggle to always opt in in using wasm?module? If I understand things correctly, then this would be desired for every nuxt project - independent on where it would be published in the end.

@jkomyno
Copy link
Copy Markdown
Contributor Author

jkomyno commented Aug 22, 2025

Would it be possible to have a toggle to always opt in in using wasm?module? If I understand things correctly, then this would be desired for every nuxt project - independent on where it would be published in the end.

Hi @tobiasdiez, we have previously discussed this possibility with the maintainer of unjs/unwasm, but it shouldn't be necessary at this moment.

Currently, and in the upcoming Prisma 6.15.0 release as well, the Query Compiler Wasm will be loaded as following:

  • from a base64-encoded file, if you specified runtime = "nodejs" | "deno" | "bun" (if you didn't specify anything, nodejs is the default)
  • from a local ./<filename>.wasm?module import, if you specified runtime = "workerd" | "vercel-edge"

So, if your Nuxt project is hosted on e.g. Vercel's Node.js runtime or Deno Deploy, Prisma will load the base64-encoded file.
I hope this helps :)

@jkomyno jkomyno merged commit 9b8e186 into main Aug 22, 2025
396 checks passed
@jkomyno jkomyno deleted the feat/prisma-client-edge-always-use-module-import-wasm branch August 22, 2025 09:32
@tobiasdiez
Copy link
Copy Markdown

Sounds good. I'm happy with whatever solution as long as I can successfully create a production deployment against the nodejs runtime with nuxt + prisma 🦊 Currently, this is not working with the base64-encoded file.

@jkomyno
Copy link
Copy Markdown
Contributor Author

jkomyno commented Aug 22, 2025

Sounds good. I'm happy with whatever solution as long as I can successfully create a production deployment against the nodejs runtime with nuxt + prisma 🦊 Currently, this is not working with the base64-encoded file.

Can you link me to a project that doesn't work in the scenario you describe? I have this example (a copy of https://github.com/prisma/prisma-examples/tree/feat/prisma-client-fixes/generator-prisma-client/nuxt3-starter-nodejs) that works well both locally and deployed to Vercel.

(Maybe you shared a link in another thread already; if so, I apologise. My Github notifications are exploding lol)

@tobiasdiez
Copy link
Copy Markdown

I've played around with the examples in the prisma-example repo and none of them are working for me at the moment. I've opened PR's and issues in that repo. I'm aware that they use slightly older prisma versions, but I actually run in the same issues with the latest release. Would be nice if you could have a look.

(and a few smaller fixes in prisma/prisma-examples#8282 should be ready to go)

@jkomyno
Copy link
Copy Markdown
Contributor Author

jkomyno commented Aug 22, 2025

I've played around with the examples in the prisma-example repo and none of them are working for me at the moment. I've opened PR's and issues in that repo. I'm aware that they use slightly older prisma versions, but I actually run in the same issues with the latest release. Would be nice if you could have a look.

(and a few smaller fixes in prisma/prisma-examples#8282 should be ready to go)

Have you used the examples from the feat/prisma-client-fixes branch (the one I posted) as a reference? Or do they also not work for you?

@tobiasdiez
Copy link
Copy Markdown

That was with latest branch, but same error with your branch (see prisma/prisma-examples#8260 (comment)).

@jkomyno
Copy link
Copy Markdown
Contributor Author

jkomyno commented Aug 22, 2025

That was with latest branch, but same error with your branch (see prisma/prisma-examples#8260 (comment)).

Replied in prisma/prisma-examples#8260 (comment). Not a Prisma error :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module Path Resolution Error When Using Monorepo + Nitro + Prisma

3 participants