sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7k stars 434 forks source link

Empty dynamic URL param #1707

Open Fanda36 opened 3 years ago

Fanda36 commented 3 years ago

Describe the bug I created universal route routes/convert/[...format(.*)].svelte for handling every request (convert/*, including convert/). It works on dev server sapper dev --no-hot. When I go to localhost:3000/convert/ then I got result from [...format(.*)].svelte.

image

The problem is if I generate static web NODE_ENV=production sapper export, then mypage.com/convert/ return 404 not found.

image

To Reproduce

Expected behavior Page myweb.com/convert/ will be rendered.

Information about your Sapper Installation:

Severity How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Sapper entirely?

peopledrivemecrazy commented 3 years ago

Can you publish a repo?

zimnicky commented 3 years ago

Having the same requirements for our app:

We don't use static export, however, the described above trick with [...args(.*)] doesn't work with a dynamic app too and a workaround with index.svelte + [...args].svelte causing a lot of issues in the state management and transitions, so it would be great if this could be fixed.

I've created a repo with a modified starter template to demonstrate the issue: https://github.com/zimnicky/sapper-empty-route-test

Expected behavior: /hats shouldn't return 404