Conversation
Starting with @sveltejs/kit 2.62.0, SvelteKit config (including the `alias` option) can be passed directly through the sveltekit() Vite plugin, so path aliases no longer require editing svelte.config.js. Document this alongside the existing svelte.config.js form, which remains the default for older SvelteKit versions. Fixes huntabyte#2750 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Order the svelte.config.js example first (default, all versions) and the new vite.config.ts option second, matching the existing docs convention of leading with the option that works everywhere. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
…s for older SvelteKit Follows the maintainer's suggestion in huntabyte#2750: show the vite.config.ts form first (SvelteKit 2.62.0+, where config passed to the sveltekit() plugin replaces svelte.config.js), and note that older versions keep the aliases in svelte.config.js. Co-Authored-By: Claude Fable 5.1 <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.
What was wrong
The SvelteKit and manual installation pages only showed configuring path aliases in
svelte.config.js. Since@sveltejs/kit2.62.0 (sveltejs/kit#15944) the SvelteKit config, includingalias, can be passed directly to thesveltekit()Vite plugin invite.config.ts, and when you do thatsvelte.config.jsis ignored. The docs never mentioned this.What changed
Following @ieedan's suggestion on the issue, both pages now lead with the
vite.config.tsexample and add the note: "When using SvelteKit versions older than 2.62.0, the aliases configuration will be in yoursvelte.config.jsfile instead", keeping the originalsvelte.config.jssnippet below it.docs/content/installation/sveltekit.mddocs/content/installation/manual.mdThe
vite.config.tsexample uses the flat option shape (sveltekit({ alias }), nokitwrapper), matching the SvelteKit configuration docs.Verification
Fixes #2750