-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make it easier to bundle @trpc/server
#1375
Comments
Feel free to add your project to https://trpc.io/docs/awesome-trpc 🙃 |
Superseded by #1597. If you wanna work on it, I'll pay you. :) |
This issue has been locked because it had no new activity for 14 days. If you are running into a similar issue, please create a new issue. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently it requires two workarounds
http
module must be ignored manuallyWith these workarounds I was able to bundle it with esbuild using this script
Why?
Bundling allows to run it non-node.js environments such as Cloudflare Workers, browsers, Remix in without node.js and possibly in Deno too.
Here's a proof of concept running it in a Cloudflare Workers https://github.com/esamattis/trpc-cloudflare-worker
What could be done?
The url module installation is OKish workaround but it would better to just get rid of it and use URLSearchParams instead which is available as a global in all these environments including Node.js.
The
import { router } from "@trpc/server"
should not end importing thehttp
module. Only the adapter file using it should import it.The text was updated successfully, but these errors were encountered: