kit icon indicating copy to clipboard operation
kit copied to clipboard

Adapter static does not export an index.html for root redirect

Open ecstrema opened this issue 4 years ago • 2 comments

Describe the bug

When using adapter static with a redirect server root, no root index.html is exported.

This results in a 404 error when fetching the root index.html, instead of redirecting to the wanted location.

src/

  • routes/
    • index.ts --> this one redirects to en/index.svelte
    • en/
      • index.svelte

What happens:

No root index.html is created when exporting with adapter static.

That is normal, since server routes are simply ignored, but :

What i'd like

  1. Emit a warning about using adapter static with a repo that has server routes.
  2. // MAYBE?? Provide a better way to use redirect routes

Workaround

replace index.ts with index.svelte and put the script content in <script context="module>

Reproduction

coming soon

Logs

No response

System Info

Github Pages

Severity

annoyance

Additional Information

No response

ecstrema avatar Oct 01 '21 18:10 ecstrema

reproduction

npm run build

verify that there is no index.html in the build dir

ecstrema avatar Oct 01 '21 18:10 ecstrema

i just started recently with sveltekit with latest 1.0.0-next.303 and npm run build didnt create an index.html file too. downgrading in package.json:

@sveltejs/adapter-static": "1.0.0-next.28",
"@sveltejs/kit": "1.0.0-next.291"

did the trick, now it creates the index.html file also doing that i got some strange error during npm install, or warning i dont know, about "prepare": "svelte-kit sync", i just erased that line. Any recommendations, updates about this? thank you

raowl avatar Mar 26 '22 23:03 raowl

This was fixed some time ago - adapter-static now includes a index.html which includes a meta tag with a redirect.

dummdidumm avatar Jan 10 '23 14:01 dummdidumm