cloudflare / cloudflare/workers-sdk
[@cloudflare/vite-plugin] Dev server crashes at startup with `Missing field moduleType` when an Astro 7 project uses @astrojs/vue
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### Summary
With Astro 7 + `@astrojs/cloudflare` 14 (which uses `@cloudflare/vite-plugin`), `astro dev` crashes before becoming ready when the project includes the `@astrojs/vue` integration. The workerd-side runner rejects a module definition:
```
Missing field `moduleType`
Stack trace:
at runInRunnerObject (workers/runner-worker/index.js:107:3)
at null. (workers/runner-worker/index.js:356:37)
```
`vite build` on the same project succeeds; only the dev server is affected.
### Versions
- `@cloudflare/vite-plugin` 1.51.2, `miniflare` 5.20260804.0-alpha, `wrangler` 4.120.1
- `astro` 7.2.0 (bundled vite 8.2.1), `@astrojs/cloudflare` 14.2.0, `@astrojs/vue` 7.0.2, `@vitejs/plugin-vue` 6.0.5 (also reproduced with 6.0.8)
- macOS (darwin 25.3.0), node 24.12.0
- `wrangler.toml`: `nodejs_compat`, D1/KV/R2/AI bindings
### Reproduction / bisection
Minimal config boots fine:
```js
export default defineConfig({
output: 'server',
adapter: cloudflare({ imageService: 'compile', remoteBindings: false }),
});
```
Adding **only** the Vue integration reproduces the crash 100% of the time:
```js
export default defineConfig({
output: 'server',
integrations: [vue()],
adapter: cloudflare({ imageService: 'compile', remoteBindings: false }),
});
```
### Not fixed by
- `@vitejs/plugin-vue` 6.0.8 (latest)
- `vite.ssr.noExternal: [/^vue/, /^@vue\//]`
- Removing the project's custom `main` worker entry from wrangler.toml
### Timing details (DEBUG=vite:load,vite:resolve)
The crash happens at server creation, during the export-types probe. The last activity before death:
```
vite:resolve 0.60ms //index.html -> null
vite:resolve 3.30ms index.html -> null
vite:resolve 0.22ms virtual:cloudflare/export-types -> virtual:cloudflare/export-types
vite:load 2.89ms [plugin] virtual:cloudflare/export-types
Missing field `moduleType`
```
The error message format (backticked field name) looks like workerd-side deserialization of a module definition that reached the worker loader without a `moduleType`/type field — plausibly a module served with a MIME type outside the known map once the Vue renderer's module graph is pulled in by the export-types evaluation.
Happy to provide a full repro repository or more debug output if useful.
Contributor guide
Research direction
Reproduce with Astro 7 plus @astrojs/vue and inspect the export-types probe at virtual:cloudflare/export-types, then trace the failure into workers/runner-worker/index.js, especially the reported lines 107 and 356. Confirm the module definition reaching the runner has the required moduleType and verify that astro dev becomes ready with Vue while vite build still succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100