-
Notifications
You must be signed in to change notification settings - Fork 244
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
Avoid regex crate for wasm bundle size (to keep cloudflare free plan) #5008
Milestone
Comments
mizchi
changed the title
Avoid regex crate due to wasm bundle size
Avoid regex crate for wasm bundle size (to keep cloudflare free plan)
Sep 28, 2024
This comment was marked as outdated.
This comment was marked as outdated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This PR significantly increases the prisma-engine wasm build and makes it impossible to build with the free Cloudflare Workers plan!
over 1M (cloudflare limit) for pogtgress
#5002 (comment)
Problem
In fact, regex crate is getting into the runtime on this line
https://github.com/prisma/prisma-engines/pull/5002/files#diff-7a3b1196bc58de119ae8a5d92271b4749892576c8a8548394ce5e17ca9019186R1-R37
I have done some preliminary research on this and it is +650k if you bundle rust regex crate with wasm.
(these are my notes in Japanese, sry)
https://zenn.dev/mizchi/scraps/413cd989324fc7
Solution.
For simple regular expressions like this one, you can solve it by switching to borrow the regex engine from the JS host in js_sys::RegExp.
https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.RegExp.html
Here's a simple snippet that uses it.
The text was updated successfully, but these errors were encountered: