✘ [ERROR] Could not resolve "cloudflare:email"
app/routes/example.ts:1:29:
1 │ import { EmailMessage } from "cloudflare:email";
╵ ~~~~~~~~~~~~~~~~~~
You can mark the path "cloudflare:email" as external to exclude it from the bundle, which will remove this error.
Since the build runs on Node it can't access those packages, try to move them to the Cloudflare server file and use getLoadContext to inject them into your Remix app.
What version of Remix are you using?
2
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
run
npx create-remix --template remix-run/remix/templates/cloudflare-pages
Add
app/routes/example.tsx
that containsrun
npm run build
Expected Behavior
Build succeeds on Cloudflare:
info built
Actual Behavior
Build fails: