Nik
Nik

Reputation: 53

SvelteKit Static adapter add '.html' to href when building for production

I'm using SvelteKit with the static adapter.

How can I change an <a href="/otherPage".../> so that when I run npm run build I get an href with the .html extension added?

Because currently when I run build my links are without .html so my static server can't resolve the HTML. And when adding the .html extension to the link it fails during npm run dev.

It's sadly not possible to change the webserver config.

Searches on the web only pointed me to export const trailingSlash = 'always'; but I don't see how that should help me.

Upvotes: 0

Views: 793

Answers (1)

brunnerh
brunnerh

Reputation: 185180

trailingSlash helps if pre-rendering is enabled, by generating one index.html per route, which should be resolvable by the most incompetent of HTTP file servers.

Upvotes: 1

Related Questions