Repository navigation
fix: stop permanent 504 Outdated Optimize Dep under multi-environment plugins - #260
Conversation
🦋 Changeset detectedLatest commit: eb5f176 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Walkthrough
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/run/src/vite/plugin.ts (1)
561-563: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the new comment.
The comment spans three lines and records a version-specific regression. Replace it with a one- or two-line intent statement.
As per coding guidelines, comments must be a last resort, limited to two lines, and capture intent rather than historical implementation details.
Proposed change
- // Since vite 8.1.4 a client dep discovered before the optimizer - // finishes init keeps a permanently stale hash under multi-environment - // plugins (e.g. `@cloudflare/vite-plugin`), 504ing every request for it. + // Avoid stale optimized-dependency responses in multi-environment dev.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/run/src/vite/plugin.ts` around lines 561 - 563, Shorten the comment above the optimizer initialization logic to one or two lines that state the intent: defer handling client dependencies until optimizer initialization completes to avoid stale hashes in multi-environment plugins. Remove the Vite version reference, regression history, and request-level symptom details.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/run/src/vite/plugin.ts`:
- Around line 561-563: Shorten the comment above the optimizer initialization
logic to one or two lines that state the intent: defer handling client
dependencies until optimizer initialization completes to avoid stale hashes in
multi-environment plugins. Remove the Vite version reference, regression
history, and request-level symptom details.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c1c38d1c-8afc-4f58-9a6f-ab08aa3197a9
📒 Files selected for processing (3)
.changeset/cf-outdated-optimize-dep.mdagent-feedback/bugs.mdpackages/run/src/vite/plugin.ts
💤 Files with no reviewable changes (1)
- agent-feedback/bugs.md
Description
@marko/run: dev client environments now setoptimizeDeps.ignoreOutdatedRequests(respecting an explicit user value), so a dep whose embedded hash diverged from the optimizer's committed hash serves the current bundle instead of 504ing forever.Motivation and Context
With a multi-environment plugin sharing the dev server (reproduced with
@cloudflare/vite-pluginandviteEnvironment: { name: "ssr" }), every request for an optimized client dep likemarko/debug/domreturned504 Outdated Optimize Depand the reload loop never converged — zero hydration in dev. Bisected to Vite 8.1.4 (vitejs/vite#22852): a client dep discovered before the optimizer finishes init keeps its discovery-time hash after later commits, so the rewrite embeds a hash serving permanently rejects. Verified against the repro on Vite 8.1.5: the previously-504ing URL serves 200 with this change. The underlying stale-entry behavior is a Vite bug to report upstream.Checklist: