Drop the base path SvelteKit never read, and CI's BASE_PATH behind it - #229
Merged
Merged
Conversation
svelte.config.js ended with adapter-static's GitHub Pages recipe,
config.paths = { base: ... process.env.BASE_PATH }, set on the top
level of the config (cf68c7a, October 2023) instead of under `kit`.
SvelteKit reads `paths` only under `kit` and lets unknown top-level
keys through without a word, so the base has always been '', which is
what langx.io, served from the domain root, needs. Moved under `kit`,
where it looks like it belongs, the line would have put CI's /website
in front of every URL. The BASE_PATH entries in the build steps of
test.yml and deploy.yml only fed it; deploy.yml keeps VITE_POSTHOG_KEY.
Built before (BASE_PATH unset, and /website as in CI) and after: the
output differs only where the build version reaches it.
Co-Authored-By: Claude Opus 5.5 <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.
svelte.config.jsended withconfig.paths = { base: process.argv.includes('dev') ? '' : process.env.BASE_PATH };. It is adapter-static's GitHub Pages recipe, added in October 2023 (cf68c7a) when the site still deployed to Pages, but set on the top level of the config instead of underkit. SvelteKit readspathsonly underkit, and its validator passes unknown top-level keys through without a warning, because other tools read the same file. So the base has always been'', which is what langx.io needs, since it is served from the domain root. Left in place, the line was a trap: moved underkit, where it looks like it belongs, it would put CI'sBASE_PATH(/website) in front of every URL and break the live site.The
BASE_PATHentries in the build steps oftest.ymlanddeploy.ymlonly fed that line, andgit grep BASE_PATHnow finds nothing. Intest.ymlthe step loses itsenv:block, becauseBASE_PATHwas all it held.deploy.ymlkeepsVITE_POSTHOG_KEYand its comment.kit.paths.relative: falsefrom #228 stays.Checked, on Kit 2.70.3 under Node 20 as in CI:
npm run checkfinds 0 errors. I ranvite buildbefore the change (withBASE_PATHunset, and with/websiteas CI sets it) and after it. Then I normalized what the build version changes:_app/version.json, each page's__sveltekit_<hash>global, and the names of the four_app/immutablefiles that depend on it. After that, all 1371 HTML files and every other file outside_app/are identical, and so are 288 of the 289 files inside it. The last is the chunk that inlines the version. It matches token for token, except that esbuild swappedkandSin eight minified names: it ranks names by character frequency, and the new build's global,__sveltekit_17qfk29, has ak. The two builds before the change also match each other, soBASE_PATH=/websitenever reached the output even with the line there.🤖 Generated with Claude Code