Skip to content

[@cloudflare/vite-plugin] Dev server crashes at startup with Missing field moduleType when an Astro 7 project uses @astrojs/vue #15129

Description

@georges-etienne-fortin

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.<anonymous> (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:

export default defineConfig({
  output: 'server',
  adapter: cloudflare({ imageService: 'compile', remoteBindings: false }),
});

Adding only the Vue integration reproduces the crash 100% of the time:

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 /<project>/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions