Title: Astro: void/email crashes astro dev with 'exports is not defined' when void is installed · Issue #411 · voidzero-dev/void · GitHub
Open Graph Title: Astro: void/email crashes astro dev with 'exports is not defined' when void is installed · Issue #411 · voidzero-dev/void
X Title: Astro: void/email crashes astro dev with 'exports is not defined' when void is installed · Issue #411 · voidzero-dev/void
Description: Summary In an Astro app with @astrojs/cloudflare, importing void/email crashes astro dev with ReferenceError: exports is not defined when void is installed from npm. This is the same crash #407 fixes for runtimes Void owns, but Astro is ...
Open Graph Description: Summary In an Astro app with @astrojs/cloudflare, importing void/email crashes astro dev with ReferenceError: exports is not defined when void is installed from npm. This is the same crash #407 fix...
X Description: Summary In an Astro app with @astrojs/cloudflare, importing void/email crashes astro dev with ReferenceError: exports is not defined when void is installed from npm. This is the same crash #407 fix...
Opengraph URL: https://github.com/voidzero-dev/void/issues/411
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Astro: void/email crashes astro dev with 'exports is not defined' when void is installed","articleBody":"## Summary\n\nIn an Astro app with `@astrojs/cloudflare`, importing `void/email` crashes `astro dev` with `ReferenceError: exports is not defined` when `void` is installed from npm. This is the same crash #407 fixes for runtimes Void owns, but Astro is left out of that fix.\n\n## Cause\n\n#407 adds `optimizeDeps.include: ['void > email-validator']` only when `!isNodeTarget(config.target) && !frameworkOwnsCloudflareRuntime`. `frameworkOwnsCloudflareRuntime` is true for every class b/c framework (`plugin-inference.ts`: SvelteKit, Nuxt, Analog, Astro). The stated reason is that those frameworks run dev server rendering in Node, which loads CommonJS itself.\n\nThat holds for SvelteKit (`getPlatformProxy`), Nuxt and Analog (Nitro). It does not hold for Astro: `@astrojs/cloudflare` 14.x calls `cfVitePlugin({ viteEnvironment: { name: 'ssr' } })`, so Astro's dev `ssr` environment runs in workerd. Void still applies only `exclude: ['void']` there.\n\nVite skips dep discovery for bare imports whose importer is inside `node_modules`. So an installed `void` importing `email-validator` (CommonJS) sends it to workerd unconverted. The Astro playground links `void` via `workspace:*`, which hides the bug in this repo.\n\n`docs/guide/email/sending.md` says sends from Astro in dev return `BINDING_MISSING`. In practice the route fails with a 500.\n\n## Reproduction\n\n1. Copy `playground/astro` and install `void` as a packed tarball (`vp pm pack`), not a symlink.\n2. Add `src/pages/api/email.ts`, which calls `sendEmail` from `void/email`, then run `astro dev`.\n3. `GET /api/email` returns 500 `exports is not defined` (`at runInRunnerObject (workers/runner-worker/index.js)`).\n4. With `optimizeDeps.include: ['void > email-validator']` added to the `ssr` environment, it returns `200 {\"ok\":false,\"error\":\"BINDING_MISSING\"}`, which matches the docs.\n\n## Suggested fix\n\nDecide per environment whether it runs in workerd, not per framework class. For example, check whether the environment's resolve conditions include `workerd`, or at minimum treat `detected?.name === 'astro'` as needing the include. Add an Astro case next to the Analog case in `plugin-dev-asset-routing.test.ts`.\n","author":{"url":"https://github.com/Brooooooklyn","@type":"Person","name":"Brooooooklyn"},"datePublished":"2026-10-12T10:11:07Z","url":"https://github.com/voidzero-dev/void/issues/411"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2031677f-5895-6576-d524-899e63925b69 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A73A:1D33A1:1DF9ED7:2895B82:6AFB9C91 |
| html-safe-nonce | 5cdc1ecb4fffac80153d6c5c3025d98411343ef29940fd85af88e2deb84f71c5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzNBOjFEMzNBMToxREY5RUQ3OjI4OTVCODI6NkFGQjlDOTEiLCJ2aXNpdG9yX2lkIjoiODQ0Mzc3NTY0MTIzNjI0OTc0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ca43cfb72a595ecf9fa9c89a9e2a80dd00286b5d9cb2860d6d61d1ae0d8591f8 |
| hovercard-subject-tag | issue:5811985501 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/411/issue_layout |
| twitter:image | https://opengraph.githubassets.com/76fa61308a43a3bdfca6a7a3d13d39af5643adfd75bd37beefa767f7377b1697/voidzero-dev/void/issues/411 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/76fa61308a43a3bdfca6a7a3d13d39af5643adfd75bd37beefa767f7377b1697/voidzero-dev/void/issues/411 |
| og:image:alt | Summary In an Astro app with @astrojs/cloudflare, importing void/email crashes astro dev with ReferenceError: exports is not defined when void is installed from npm. This is the same crash #407 fix... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Brooooooklyn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3cefd19a936819d82cfb5279d50fb56fe79cb9ec30f0f807e04e89b0c58ffae1 |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 606800bdb1b81d125fc845bdcc262c9fe063fc8f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width