Closed oscartbeaumont closed 1 day ago
First thanks for PR.
Vercel edge, is not based on cloudflare CDN.
I have tested your PR against our e2e deployments (commit: https://github.com/unjs/nitro-deploys/commit/fb1f640e1f04edbeca131f9f81a339f4e098c971)
It seems they don't support dynamic imports (at least via this change alone)
I will try to reach out to them for more info (feel free to open a tracker issue) but in the meantime it is not possible at is seems.
β Type of change
π Description
Previously when building using the
vercel_edge
preset the entire function code would be exported as a single JS file at.vercel/functions/__nitro.func/index.mjs
. This means all dyanmicimport
's are flattened to be inline.This change copies the rollup configuration from the Cloudflare preset to the Vercel edge preset so this is no longer the case and dynamic imports actually lazily import code.
This changes allows me to lazy load less important code instead of requiring it all to be loaded and parsed at server startup.
This change aligns the
vercel_edge
preset with Nitro's existing Cloudflare presets which seems logical because Vercel's Edge functions run on Cloudflare Workers.π Checklist