Repository navigation
Treat Vite's resolved outDir values as the source of truth for build output - #18112
Conversation
🦋 Changeset detectedLatest commit: 021eae7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
24d8d29 to
3ea3407
Compare
3ea3407 to
579ed25
Compare
There was a problem hiding this comment.
This PR changes Astro to treat Vite’s resolved outDir values as the canonical output directories during build. The implementation threads a new outputDirectories object through the build pipeline, uses it for asset generation, prerender output, SSR manifest paths, and build hooks, and defers .vite manifest cleanup until after all buildApp hooks run so platform plugins can consume the manifests. Custom prerenderer factories now receive those resolved directories via a new context argument.
Static review found the changes coherent and well-scoped:
StaticBuildOptionsis cleanly split into pre-resolution input and post-resolution options.getResolvedOutputDirectoriesreads the final environment configs from the Vite builder afterbuildApp()completes.- Plugin handlers that previously hard-coded
settings.config.build.*now pullthis.environment.config.build.outDiror use the resolved directories. - The new integration test exercises a Vite plugin mutating environment
outDirs and asserts that hooks, the SSR manifest, and custom prerenderers all see the resolved values while the Astro config remains unchanged. - Existing unit tests for
getOutFolder,generate.test.ts, and the incremental-build cache paths were updated to match the new resolved-directory behavior. - Two changesets cover both behavioral changes (minor for resolved directories / prerenderer context, patch for deferred manifest cleanup).
No correctness, security, runtime portability, or repository-policy issues were identified in the reviewed scope. The change appears ready to merge based on static review alone.
This review was made by an LLM. The analysis may be wrong, and reports might be incorrect.
ourDir values as the source of truth for build outputoutDir values as the source of truth for build output
…build output (#18112) (#18313) Backport of #18112 from next to main. Generated assets, build hook `dir` values, and SSR manifest paths use the resolved client, server, and prerender environment outDirs. Custom prerenderer factories receive these via a new context argument. Vite manifest cleanup is deferred until all buildApp hooks complete. (cherry picked from commit c68d737) Co-authored-by: James Opstad <[email protected]> Co-authored-by: ematipico <[email protected]>
Changes
Astro now treats Vite's resolved
outDirvalues as the source of truth for build output. Generated assets, build hookdirvalues, and SSR manifest paths use the resolved client, server, and prerender directories. Custom prerenderer factories also receive these directories through a new context argument.Additionally, manifest cleanup is now deferered until all
buildApphooks have completed, allowing platform plugins to consume the manifests.Testing
Tests added to validate that the new behaviour. Existing tests validate that this change hasn't broken output directory path handling.
Docs
This is primarily an internal change but is relevant to integration authors.