-
Notifications
You must be signed in to change notification settings - Fork 11
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
Leverage nodejs conditional exports #35
Comments
I also want to investigate if this will allow us to avoid dynamic imports and the need to set the |
While digging into next.js, I found that they use quite an eclectic series of fields and it varies based on build target (edge, node/SSR, and client). It'll take some time to figure out what works where. |
I found that we can use |
Cloudflare seems to prefer |
See also: cloudflare/workers-sdk#2629 |
…ely (#887) Closes #35 This leverages conditional exports for various platforms: `"edge-light"` for Vercel, `"workerd"` for Cloudflare, and `"default"` for our base64 Wasm implementation. There is a lot of code duplication because it's hard to reason about the exports from inside the package and I didn't want to try to design an API that would be imported into each file. I also had to rework our Rollup logic because the Cloudflare docs don't match their implementation as of the newest Wrangler.
I think we can leverage nodejs conditional exports to adjust our Wasm imports for the platform we are targeting.
Depending on how tools handle packages, this should reduce some false positives for any capabilities checks, such as if you are using arcjet-analyze on the edge or with a bundler and don't need the filesystem read we provide for nodejs.
We could use
"worker"
,"browser"
, and"default"
keys.See also vercel/next.js#39094
The text was updated successfully, but these errors were encountered: