Skip to content

[vite-plugin] Clear Worker export types when the dev server closes - #16457

Closed
Eshan05 wants to merge 1 commit into
cloudflare:mainfrom
Eshan05:fix/vite-plugin-reset-export-types
Closed

Eshan05 wants to merge 1 commit into
cloudflare:mainfrom
Eshan05:fix/vite-plugin-reset-export-types

Conversation

@Eshan05

@Eshan05 Eshan05 commented Oct 24, 2026 •

Copy link
Copy Markdown

Fixes #16324

The plugin caches each Worker's export types in module-level state so that Vite restarts can reuse them. Nothing cleared that cache on server.close(), so a dev server created later in the same process built its Worker entry from the previous server's exports. That entry left out Durable Object classes the previous Worker didn't export, and workerd failed to start with Class extends value undefined is not a constructor or null.

disposeMiniflare() now clears the export types too. It runs only when the server closes, not during a restart, so restarts still reuse them.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this fixes a dev server startup failure and does not change any configuration or API

Devin Review

Signed-off-by: Eshan05 <nahareshan05@gmail.com>
@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73d2758

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Eshan05. Thanks for taking the time to contribute to Workers SDK.

This PR has been automatically closed because you are not currently a registered (vouched) collaborator for this repository.

AI tools now let our team generate proposed code changes quickly. Reviewing changes, checking that they solve the right problem, and maintaining code quality over time still take substantial care and effort. We therefore limit PRs to registered collaborators so we can focus that effort where it is most useful.

For the majority of external contributors, the most effective way to help is through issues: describing a problem or use case, providing a minimal reproduction, investigating its cause, or helping us verify a fix. Those contributions help us understand what needs to change and are very welcome.

We will take an initial look at this PR and decide whether it is something we want to invest time in reviewing and maintaining. We may reopen it if we decide to proceed, but we cannot guarantee that it will be reopened or receive a full review.

@github-actions github-actions Bot closed this Oct 24, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Oct 24, 2026
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team October 24, 2026 09:22
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/vite-plugin-reset-export-types.md: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/tests/sequential-dev-servers.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/context.ts: [@cloudflare/wrangler]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

vite-plugin: second createServer in one process fails after worker exports change

2 participants