Skip to content

[vite-plugin] Ignore .wrangler persistence writes in Vite's file watcher - #15574

Merged
petebacondarwin merged 2 commits into
cloudflare:mainfrom
RealBhupesh:fix/vite-ignore-wrangler-watch
Sep 12, 2026
Merged

petebacondarwin merged 2 commits into
cloudflare:mainfrom
RealBhupesh:fix/vite-ignore-wrangler-watch

Conversation

@RealBhupesh

@RealBhupesh RealBhupesh commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15550.

Miniflare writes D1/KV/R2/observability state under .wrangler/state. That directory was already in server.fs.deny, but Vite's watcher still picked up the writes on Linux and Windows, so every plugin hotUpdate hook ran on ordinary requests.

This adds **/.wrangler/** to server.watch.ignored, appending to any ignore patterns the user already set.


  • 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 is internal Vite watcher configuration; there is no user-facing API or config change.

Made with Cursor


Devin Review

Miniflare persistence writes under .wrangler/state were treated as source
changes on Linux and Windows, firing every plugin hotUpdate hook.

Fixes cloudflare#15550
@changeset-bot

changeset-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 37b34e3

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-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Sep 9, 2026
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team September 9, 2026 04:30
@workers-devprod

workers-devprod commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15574

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15574

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15574

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15574

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15574

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15574

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15574

miniflare

npm i https://pkg.pr.new/miniflare@15574

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15574

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15574

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15574

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15574

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15574

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15574

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15574

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15574

wrangler

npm i https://pkg.pr.new/wrangler@15574

commit: 37b34e3

Returning a watch object when the user set server.watch to null turned
watching back on. Preserve that disable, wrap ignored for oxfmt, and
keep other watch options.
@RealBhupesh

Copy link
Copy Markdown
Contributor Author

Addressed the server.watch: null review: getServerWatchConfig() now returns null when watching is disabled, so we do not turn the watcher back on. Also wrapped the ignore merge for oxfmt.

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Sep 12, 2026
@petebacondarwin
petebacondarwin merged commit 164e4fb into cloudflare:main Sep 12, 2026
70 of 73 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Sep 12, 2026
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.

Miniflare writes state to .wrangler/state, causing HMR to rebuild (Linux/Windows only)

3 participants