Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link in html files are wrong for routes when using adapter-static #3014

Closed
myhrmans opened this issue Dec 10, 2021 · 3 comments
Closed

Link in html files are wrong for routes when using adapter-static #3014

myhrmans opened this issue Dec 10, 2021 · 3 comments
Labels
bug Something isn't working p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Milestone

Comments

@myhrmans
Copy link

Describe the bug

When building using adapter-static and going to the output folder to check the index.html files you can see that the links
`

	<link rel="modulepreload" href="/_app/chunks/vendor-3d58c1d9.js">

	<link rel="modulepreload" href="/_app/chunks/preload-helper-ec9aa979.js">

	<link rel="modulepreload" href="/_app/chunks/singletons-ff603286.js">

	<link rel="stylesheet" href="/_app/assets/start-61d1577b.css">`

or in this case; the entire file is identical.
The links are relative but when creating routes they should be relative to where the index files are stored.

the viewed file in the below image is /_app/home/prototype/index.html but the links in it refer to /_app... but should be ../../../_app
image

Opening one of these index files will result in a "FILE_NOT_FOUND"

Reproduction

https://github.com/myhrmans/sveltekit-link-generation-bug

Logs

No response

System Info

System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 440.27 MB / 31.28 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.93
    Chromium: 96.0.4664.45
    Firefox: 95.0

Severity

blocking all usage of SvelteKit

Additional Information

No response

@iacore
Copy link

iacore commented Jan 9, 2022

You were using file:// transport, which is platform-dependent. You are not supposed to visit a website from disk. Run a HTTP server and visit the website that way. python -m http.server is a simple HTTP server.

@Rich-Harris Rich-Harris added this to the 1.0 milestone Apr 24, 2022
@benmccann benmccann added p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. bug Something isn't working labels Jul 19, 2022
@Rich-Harris Rich-Harris modified the milestones: 1.0, whenever Jul 20, 2022
@myhrmans myhrmans reopened this Aug 18, 2022
@myhrmans
Copy link
Author

Wrong button...

@Rich-Harris
Copy link
Member

Closing, as SvelteKit uses relative links in all cases except an explicit paths.asset or fallback prerendering, so this should work even with file:// URLs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Projects
None yet
Development

No branches or pull requests

4 participants