Repository navigation
[vite-plugin] Complete v1 framework builds and imported assets - #16817
edmundhung merged 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 1609502 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 |
|
@jamesopstad (verified author of #16761) and @petebacondarwin (latest qualifying pre-merge human ant-core approver, November 9 13:24:33Z): please check this v1 backport and approve it if it looks good. V1 retains the builder callback needed by Vite 6 and its Wrangler output configuration. The remaining change completes environments once, collects imported assets from bundles rather than removable manifests, and transfers entry/child/prerender assets into client output while preserving prerender originals. Three plugin integration regression cases pass; build, all 58 checks and all 8 package test tasks pass, including 265 plugin tests. Affected playground and Vite 6 compatibility validation are being finalized. #16801 already supplies the November 10 dependency graph beneath this PR, so no dependency upgrades or upstream dependency tests are repeated here. Added to native GitHub stack #16738; merge the stack in order. |
commit: |
|
Codeowners approval required for this PR:
|
There was a problem hiding this comment.
Superseded by the review of
1609502d.
This review, of e09da0d2
💬 Approved with comments — The build and asset-transfer logic looks correct and is covered by regression tests. The only findings are two INFO cleanup notes: a leftover unused option and duplicated post-hook logic.
Findings: 2 info (2 are inline comments on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 2 info
Logic looks correct. Two small cleanup items.
Recommendation: 💬 Optional Nits
- [INFO]
isEntryWorkeris no longer read but stays in the options type and its callers (packages/vite-plugin-cloudflare/src/cloudflare-environment.ts) - [INFO] The post
buildApphook repeats the Worker builds andremoveAssetsFieldthatbuildAppin build.ts already does (packages/vite-plugin-cloudflare/src/plugins/config.ts:181)
View full review
createCloudflareEnvironmentOptionsstill declares and receivesisEntryWorker, but nothing reads it any more.- The post
buildApphook callsbuildApp(...)first.buildAppalready builds the remaining Worker environments and removes theassetsfield. The hook then repeats both steps. This is harmless because the build calls checkisBuiltand removing the field twice changes nothing, but the logic now lives in two places.
✅ All other checks passed
🚀 Release: ✅ LGTM
Risk: low. The plugin patch changeset is present.
🔒 Security: ✅ LGTM
No security concerns in the build and config changes.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md concerns.
⚡ Performance: ✅ LGTM
No performance concerns.
📝 Documentation: ✅ LGTM
The changeset describes the user-facing fixes.
Reviewed commit: e09da0d2
Vite 6 does not set `environment.isBuilt`, so the build still treated the client as unbuilt right after building it. It then removed the `assets` field from the entry Worker's output config and skipped moving imported assets into the client output. Also track the client build done here.
There was a problem hiding this comment.
💬 Approved with comments — The Vite 6 fix for client build tracking is correct. Only INFO notes remain: the Vite 6 child-environment asset gap, the changeset's no-rebuild wording, and duplicated post-hook logic.
Findings: 3 info (2 are inline comments on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 2 info
Build logic is sound. Two INFO notes: Vite 6 skips child-environment assets, and the post-hook logic is still duplicated.
Recommendation: 💬 Optional Nits
- [INFO] On Vite 6, child-environment imported assets are never moved, because the filter relies on
isBuilt(packages/vite-plugin-cloudflare/src/build.ts:68) - [INFO] The post
buildApphook repeats the Worker builds andremoveAssetsFieldlogic thatbuildAppin build.ts already does (packages/vite-plugin-cloudflare/src/plugins/config.ts:181)
View full review
- Vite 6 child environments (INFO):
build.ts:68keeps a child environment only whenchildEnvironment.isBuiltis true. Vite 6 never sets that flag, as the comment atbuild.ts:79says. Imported assets from child environments are therefore never moved to the client output on Vite 6. The client already gets local tracking (isClientBuilt). One option for children is to treat an environment that has an entry inenvironmentNameToImportedAssetPathsas built, sincewriteBundleonly runs after a build. - Duplicated post-hook logic (INFO): the post
buildApphook inplugins/config.tscallsbuildApp(...), then repeats the Worker-build loop and theremoveAssetsFieldbranch. This is harmless because builds checkisBuiltand removing the field twice changes nothing, but the same logic now lives in two places.
📝 Documentation: 💬 1 info
The changeset's no-rebuild claim doesn't hold on Vite 6.
Recommendation: 💬 Optional Nits
- [INFO] The changeset's "without rebuilding environments" claim doesn't hold on Vite 6 (
.changeset/v1-build-imported-assets.md:5)
View full review
- The changeset says builds complete "without rebuilding environments".
build.ts:45skips a Worker build only whenisBuiltis set, and Vite 6 never sets it, so on Vite 6 a Worker that a framework already built can be built again.
✅ All other checks passed
🚀 Release: ✅ LGTM
Risk: Low. The plugin patch changeset is present.
🔒 Security: ✅ LGTM
The source and destination paths for moved or copied assets come from the build's own bundle metadata (viteMetadata.importedAssets), not from untrusted input. The change adds no secrets, authentication changes or network exposure.
📖 AGENTS.md: ✅ LGTM
No concerns.
⚡ Performance: ✅ LGTM
No performance concerns.
Reviewed commit: 1609502d
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Backport the compatible build fixes from #16761. Framework plugins can build Workers before the Cloudflare post hook and remove Vite manifests, leaving assets missing or causing repeated builds. Complete only the remaining environments, collect imported assets from emitted bundles, move entry/child assets into the client output, and copy prerender assets while preserving their originals.
V1 keeps its builder callback because Vite 6 has no buildApp hook. Vite 7/8 also complete the same work in the post hook, including custom builder callbacks. Wrangler output configuration and removal of the assets field for Workers without client output are preserved. The v2 Build Output Specification implementation is not introduced.
The remaining diff is plugin build/config code, three integration regression cases and a plugin patch changeset. Dependency upgrades remain in #16801 beneath this PR. This PR is part of native GitHub stack #16738; merge the stack in order.
Validation: build, all 58 checks, all 8 package test tasks (265 plugin tests), and all 6 retained fixture tasks pass (30 registry, 5 harness and 2 browser tests). Affected Vite 8 build playgrounds pass: 11 tests, 3 expected skips. Vite 6.4.6 build and applicable playground coverage pass: 3 tests, 2 expected skips for unsupported features. Vite 7.1.12 build and affected playgrounds also pass: 11 tests, 3 expected skips. No credentialed E2E or full OS matrix was run.
Note
This is a contribution from an AI agent: Codex.