refactor: simplify astro.config.mjs follow-up to Astro 7 upgrade#168
Merged
Conversation
The repo-wide legacy-peer-deps=true switch was added during the Astro 7 alpha upgrade as a blanket workaround. The actual peer conflict is narrow: @sveltejs/vite-plugin-svelte-inspector@5.0.2 still pins vite-plugin-svelte ^6, which collides with the v7 we need for Vite 8. Replace the global switch with a targeted overrides entry so npm's peer-dep checking stays active for unrelated packages. Verified: npm ci passes, npm ls @sveltejs/vite-plugin-svelte resolves to a single v7.0.0, and build/test/preview all behave as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three follow-up cleanups identified after the Astro 7 upgrade landed: - Drop the local entry from siteConfig and the matching DeployTarget variant. With this gone, deployTargetEnv falls back to github-pages directly. The only previous use of siteConfig.local was producing an http://localhost site URL during dev for OGP metadata, which is now handled by Astro.site in BaseLayout. - Drop i18n.routing.prefixDefaultLocale: false. Astro's documented default is already false, so the explicit setting is redundant. - Drop the manualChunks function and its parent vite.environments block. The function was meant to split react/vue/svelte into vendor chunks, but vue was never matched (no vue-vendor chunk in dist), so it only half-worked. Letting Vite 8's default chunking handle it produces clean per-runtime chunks (react.*.js, react-dom.*.js, client.svelte.*.js) and keeps total dist size flat at ~9.3MB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
siteConfig.local in astro.config.mjs no longer provides a localhost site URL during dev, so import.meta.env.SITE is undefined there. Insert Astro.site in the fallback chain so dev OGP metadata uses the actual dev origin instead of jumping straight to the hardcoded prod URL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying apg-patterns-examples with
|
| Latest commit: |
8a4b57b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9dc5c04f.apg-patterns-examples.pages.dev |
| Branch Preview URL: | https://refactor-astro-settings.apg-patterns-examples.pages.dev |
Format check on CI flagged a long ternary that prettier wanted on a single line. Picked up automatically by prettier --write. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #167 (Astro 7.0.0-alpha.0 upgrade). Cleans up four items flagged during the post-upgrade review.
Plan worked out together with Codex.
Changes
.npmrcremoved — replaced repo-widelegacy-peer-deps=truewith a targetedpackage.json#overridesentry for@sveltejs/vite-plugin-svelte ^7.0.0. Restores npm peer-dep checking for unrelated packages.siteConfig.localremoved — only used to produce a localhost site URL for OGP metadata during dev; that responsibility moved toBaseLayout.astroviaAstro.site.DeployTargetshrinks to'github-pages' | 'cloudflare-pages'.i18n.routing.prefixDefaultLocale: falseremoved — Astro's documented default is alreadyfalse.manualChunksfunction removed (with its parent vite.environments block) — was meant to split react/vue/svelte into vendor chunks, but vue was never actually matched (novue-vendor.*.jsin dist), so the splitting was half-broken. Vite 8 now produces per-runtime chunks (react.*.js,react-dom.*.js,client.svelte.*.js) automatically; total dist size stays at ~9.3MB.Out of scope
vue({ devtools: false })— needs dev-time HMR re-verification on Astro 7 + Vue 7 alpha. Will be handled in a separate PR./ja/...pages (PatternSearch.tsxcallinggetLocaleFromDocument()in auseStateinitializer) — unchanged here.Test plan
npm ciworks without.npmrc(verified locally)npm ls @sveltejs/vite-plugin-svelteresolves to single v7.0.0npm run build— 553 pages built (~47s)npm run lint— 0 errorsnpm run test:unit— all pass (75 + 6 files, 2768 tests)🤖 Generated with Claude Code