Skip to content

Drop the base path SvelteKit never read, and CI's BASE_PATH behind it - #229

Merged
xuelink merged 1 commit into
mainfrom
claude/drop-dead-base-path
Sep 24, 2026
Merged

xuelink merged 1 commit into
mainfrom
claude/drop-dead-base-path

Conversation

@xuelink

@xuelink xuelink commented Sep 24, 2026

Copy link
Copy Markdown
Member

svelte.config.js ended with config.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 under kit. SvelteKit reads paths only under kit, 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 under kit, where it looks like it belongs, it would put CI's BASE_PATH (/website) in front of every URL and break the live site.

The BASE_PATH entries in the build steps of test.yml and deploy.yml only fed that line, and git grep BASE_PATH now finds nothing. In test.yml the step loses its env: block, because BASE_PATH was all it held. deploy.yml keeps VITE_POSTHOG_KEY and its comment. kit.paths.relative: false from #228 stays.

Checked, on Kit 2.70.3 under Node 20 as in CI: npm run check finds 0 errors. I ran vite build before the change (with BASE_PATH unset, and with /website as 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/immutable files 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 swapped k and S in eight minified names: it ranks names by character frequency, and the new build's global, __sveltekit_17qfk29, has a k. The two builds before the change also match each other, so BASE_PATH=/website never reached the output even with the line there.

🤖 Generated with Claude Code

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>
@xuelink
xuelink merged commit ca82b76 into main Sep 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant