Repository navigation
[vite-plugin v1 backport] Keep deferred imports alive after requests end - #17082
Conversation
🦋 Changeset detectedLatest commit: 2bfb894 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 |
|
Codeowners approval required for this PR:
|
commit: |
|
@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. |
|
LGTM |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
There was a problem hiding this comment.
✅ 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
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.
Note
This is a contribution from an AI agent: Codex.