Skip to content

[vite-plugin] Fix v1 builds when a framework starts a preview server - #16841

Merged
edmundhung merged 2 commits into
vite-plugin-v1from
edmundhung/vite-plugin-v1-waku-preview-build
Nov 12, 2026
Merged

edmundhung merged 2 commits into
vite-plugin-v1from
edmundhung/vite-plugin-v1-waku-preview-build

Conversation

@edmundhung

@edmundhung edmundhung commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes the Waku failures in C3 E2E, e.g. https://github.com/cloudflare/workers-sdk/actions/runs/43073393667/job/130706903895.

Waku's Cloudflare adapter starts a preview server with the same plugin instance during waku build to generate static files. That replaces the plugin's resolved config with a preview config, so the post buildApp hook changed in 1.69.0 (#16817) failed with Expected "assets-only" or "workers" plugin config. The hook now skips its work in that case, as it did before 1.69.0.


  • 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 a bug fix with no API change.

@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a4fdd7

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@cloudflare/vite-plugin@16841

commit: 9a4fdd7

@ask-bonk

ask-bonk Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

Waku starts a preview server with the same plugin instance during the
build, which replaces the build's resolved config with a preview config.
Skip the post buildApp work in that case, as 1.68.0 did, instead of
asserting.
@edmundhung
edmundhung force-pushed the edmundhung/vite-plugin-v1-waku-preview-build branch from 4e53a75 to cae21df Compare November 11, 2026 23:21
@edmundhung
edmundhung marked this pull request as ready for review November 11, 2026 23:38
@workers-devprod
workers-devprod requested review from a team and cjol and removed request for a team November 11, 2026 23:39
@workers-devprod

workers-devprod commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @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 found 2 potential issues.

Devin Review

@clanky-the-clanker clanky-the-clanker 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.

Superseded by the review of 9a4fdd7d.

This review, of cae21df4

✅ Approved — A small bug fix that brings back the behaviour from before 1.69.0, with a regression test and a changeset. No issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The post buildApp hook now returns early when the resolved config is a preview config, instead of asserting. assertIsNotPreview is still used at other places in the file, so the import is still needed. The new test reproduces the case where a framework starts a preview server during the build, and it would fail without the fix.


📝 Documentation: ✅ LGTM

The changeset accurately describes the bug fix. No public documentation changes are needed.


Reviewed commit: cae21df4

@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

@clanky-the-clanker clanky-the-clanker 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.

✅ Approved — A small bug fix that brings back the behaviour from before 1.69.0. It comes with a regression test and an accurate changeset, and no issues were found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The post buildApp hook in packages/vite-plugin-cloudflare/src/plugins/config.ts now returns early when the resolved config is a preview config, instead of asserting. Other code in the file still calls assertIsNotPreview, so its import is still needed. The new test in build-app.spec.ts starts a preview server with the same plugin instances during the build, and it would fail without the fix.


📝 Documentation: ✅ LGTM

The changeset accurately describes the user-facing fix. No public documentation changes are needed for this bug fix.


Reviewed commit: 9a4fdd7d

@edmundhung
edmundhung merged commit 3eaeb02 into vite-plugin-v1 Nov 12, 2026
25 checks passed
@edmundhung
edmundhung deleted the edmundhung/vite-plugin-v1-waku-preview-build branch November 12, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants