Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): try CJS-friendly alternative to https://github.com/prisma/prisma/pull/23754 #24029

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Apr 30, 2024

This PR is an alternative version of #23754, specifically aimed to guarantee that Prisma Client keeps working when distributed as a CommonJS package.

This PR addresses this failing e2e test, aiming to avoid the esbuild error:

[esbuild Error]: Top-level await is currently not supported with the "cjs" output format
    at /usr/local/lib/node_modules/zx/build/vendor.js:2:17

@jkomyno jkomyno self-assigned this Apr 30, 2024
@jkomyno jkomyno added this to the 5.14.0 milestone Apr 30, 2024
Copy link
Contributor

github-actions bot commented Apr 30, 2024

size-limit report 📦

Path Size
packages/client/runtime/library.js 179.77 KB (0%)
packages/client/runtime/library.d.ts 81 B (0%)
packages/client/runtime/binary.js 600.89 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 159.02 KB (0%)
packages/client/runtime/edge-esm.js 158.91 KB (0%)
packages/client/runtime/wasm.js 114.85 KB (0%)
packages/client/runtime/index-browser.js 33.77 KB (0%)
packages/client/runtime/index-browser.d.ts 89 B (0%)
packages/cli/build/index.js 2.09 MB (0%)
packages/client/prisma-client-0.0.0.tgz 3.02 MB (-0.01% 🔽)
packages/cli/prisma-0.0.0.tgz 3.72 MB (-0.01% 🔽)
packages/bundle-size/da-workers-libsql/output.tgz 888.5 KB (+0.01% 🔺)
packages/bundle-size/da-workers-neon/output.tgz 967.09 KB (+0.01% 🔺)
packages/bundle-size/da-workers-pg/output.tgz 985.82 KB (+0.01% 🔺)
packages/bundle-size/da-workers-pg-worker/output.tgz 941.54 KB (+0.01% 🔺)
packages/bundle-size/da-workers-planetscale/output.tgz 903.33 KB (-0.01% 🔽)
packages/bundle-size/da-workers-d1/output.tgz 861.55 KB (-0.01% 🔽)

Copy link

codspeed-hq bot commented Apr 30, 2024

CodSpeed Performance Report

Merging #24029 will not alter performance

Comparing integration/static-wasm-worker-loader (07075a7) with main (51ff5e4)

Summary

✅ 3 untouched benchmarks

@jkomyno
Copy link
Contributor Author

jkomyno commented Apr 30, 2024

Note, currently 2 tests are failing:

  • e2e-ios / e2e-ios (removed in main)
  • CI / Tests / Client (func/win+mac) (windows-latest, 16, library) (flaky)

@jkomyno
Copy link
Contributor Author

jkomyno commented May 13, 2024

This PR seems to fix #23600, but not #23929.

@nzws
Copy link

nzws commented May 20, 2024

I'm not sure if this is the cause of the error, but it probably requires a fix in the import destination.

In this file, I think it needs to dynamically import the loader first and then dynamically import the engine.

getQueryEngineWasmModule: async () => {
return (await import('#wasm-engine-loader')).default
}

  getQueryEngineWasmModule: async () => {
    const loader = (await import('#wasm-engine-loader')).default
    const engine = (await loader).default
    return engine
  }

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.

None yet

3 participants