Skip to content

[vite-plugin v1 backport] Keep deferred imports alive after requests end - #17082

Merged
petebacondarwin merged 2 commits into
vite-plugin-v1from
codex/vite-v1-backport-16385
Nov 21, 2026
Merged

petebacondarwin merged 2 commits into
vite-plugin-v1from
codex/vite-v1-backport-16385

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Backports #16385 to prevent deferred dynamic imports from losing their caller RPC continuation when a request returns or disconnects. The runner implementation and changeset are unchanged from the original. The complete RPC operation, result retrieval and cleanup are retained through waitUntil().

The three original integration regressions are retained. The only v1 adaptations are writing the equivalent wrangler.json instead of cloudflare.config.ts, and omitting the v2 runtime-types option. The explicit import gate, separate evaluation/settlement observations and direct workerd disconnect case are unchanged, including the Windows skip. All three fail before the fix (v1 reports an ended-request promise rather than returning the cached value/rejection) and pass after it.

Validation: pnpm build, pnpm check (58 tasks, including types/lint/format), and pnpm test:ci (8 tasks, 271 plugin tests) pass on the current v1 target with published dependencies. No dependency changes or public sibling source are included. #17054's unpublished runtime increment follows the validated backports in native GitHub stack #17084 rooted at vite-plugin-v1.


  • 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: restores existing local development behavior without a configuration change.

Note

This is a contribution from an AI agent: Codex.

@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2bfb894

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

@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team November 20, 2026 14:03
@workers-devprod

workers-devprod commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler

@pkg-pr-new

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

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

commit: 2bfb894

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

@aryasaatvik @petebacondarwin, please check this v1 backport of #16385 and approve if it looks good. You are the verified original author and latest qualifying human ant-core approver before merge (deduplicated where applicable).

The module-runner implementation is unchanged. The original three integration cases use equivalent v1 Wrangler configuration and omit the v2 runtime-types option. They fail before and pass after the fix; build, types, checks and package tests pass. This does not require the unpublished runtime increment in #17054.

devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@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 2bfb8940.

This review, of d78ce017

✅ Approved — A small backport with regression tests. Wrapping the RPC operation in waitUntil() is correct and keeps the errors callers see unchanged; 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

🚀 Release: ✅ LGTM

Overall risk: Low. A focused fix to the module runner's RPC lifetime (module-runner.ts:42-63), with integration regression coverage and a patch changeset.


🔒 Security: ✅ LGTM

No issues found.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

No issues found.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: d78ce017

@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 — This is a small backport with regression tests. Wrapping the RPC operation in waitUntil() is correct, and the Windows-only test setup added since the last review is sound. 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

🚀 Release: ✅ LGTM

Overall risk: Low. This is a focused fix to how long the module runner's RPC operation stays alive. It includes integration regression tests and a patch changeset.


🔒 Security: ✅ LGTM

No issues found.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

The module-runner.ts change hasn't changed since the last review. It wraps the RPC operation in waitUntil() and returns the same promise, so callers still see the same results and errors.

The only new change is the Windows-only beforeEach in import-lifetime.spec.ts. It calls realpath on the temp directory, changes into it, and stubs PWD to match. afterEach calls vi.unstubAllEnvs() to undo the stub. This looks correct.


⚡ Performance: ✅ LGTM

No issues found.


📝 Documentation: ✅ LGTM

No issues found.


Reviewed commit: 2bfb8940

@petebacondarwin
petebacondarwin merged commit ae2a49f into vite-plugin-v1 Nov 21, 2026
22 checks passed
@petebacondarwin
petebacondarwin deleted the codex/vite-v1-backport-16385 branch November 21, 2026 22:15
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