Assets path not replaced by _svelte_kit_assets in preview
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
One of the stated use cases for the config.kit.paths.assets config var is for the case where assets will be hosted on a separate domain to the site itself.
The docs state:
If a value for
config.kit.paths.assetsis specified, it will be replaced with'/_svelte_kit_assets'duringvite devorvite preview, since the assets don't yet live at their eventual URL.
That is what happens with vite dev. When running vite preview however, the value from config is still used. The only relevant previous issue I could find is #1154.
Reproduction
https://github.com/drzax/assets-repro
Logs
No response
System Info
System:
OS: macOS 14.4.1
CPU: (12) arm64 Apple M2 Max
Memory: 839.94 MB / 32.00 GB
Shell: 5.2.26 - /opt/homebrew/bin/bash
Binaries:
Node: 21.7.1 - /opt/homebrew/bin/node
npm: 10.5.0 - /opt/homebrew/bin/npm
pnpm: 8.15.7 - /opt/homebrew/bin/pnpm
bun: 1.0.36 - /opt/homebrew/bin/bun
Browsers:
Chrome: 124.0.6367.119
Edge: 124.0.2478.67
Safari: 17.4.1
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.2.0
@sveltejs/adapter-static: ^3.0.1 => 3.0.1
@sveltejs/kit: ^2.0.0 => 2.5.7
@sveltejs/vite-plugin-svelte: ^3.0.0 => 3.1.0
svelte: ^4.2.7 => 4.2.15
vite: ^5.0.3 => 5.2.10
Severity
blocking all usage of SvelteKit
Additional Information
We need to be able to debug production builds locally and this is currently blocking that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked assets-repro reproduction and compare how config.kit.paths.assets is handled by vite dev versus vite preview. Done means vite preview replaces the configured asset path with /_svelte_kit_assets, matching the documented behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, vite
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100