sveltejs / sveltejs/kit

`adapter-static` configuration item `assets` does not affect `%sveltekit.assets%`

Open
#12,411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-static
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

When setting adapter-static configuration item assets to a custom location (e.g. the folder build/assets. The path %sveltekit.assets% and paths to other resources are not affected and they still point to /_app instead of assets/_app.

Reproduction
  1. Open: https://stackblitz.com/edit/sveltejs-kit-template-default-yqrfta?file=build%2Findex.html
  2. Run: npm i -D @sveltejs/adapter-static
  3. Run: npm run build
  4. Check out file paths at build/index.html
Logs
Logs are not relevant.
System Info
System info is not relevant.
Severity

annoyance

Additional Information

This is required in order to cleanly separate projects by namespacing URLs (e.g. /assets for Svelte and /api for REST). Then you can tell the web server to redirect /api to the backend and serve /assets to clients while still being able to serve index.html for domain /. There are many workarounds obviously, but no "clean" solutions (at least my opinion).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the StackBlitz reproduction and inspect build/index.html after installing @sveltejs/adapter-static and running npm run build. Trace how the adapter-static assets option is applied to generated paths, and confirm done when %sveltekit.assets% and other resource paths use the configured assets location instead of /_app.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.