Project setup
I have a sapper application with a header containing 2 links rendered using <a> tags (page1 and page2). These <a> tags contain slug names (page1, page2). Clicking on these links will go to the [slug].svelte page.
project structure
src/
routes
[slug].svelte
_error.svelte
_index.svelte
etc
I export my application using
npm run export
I can see the following is created in the export folder,
__sapper__
export
page1
index.html
page2
index.html
Therefore showing the links are correctly crawled and the [slug].svelte has been used to create my 2 pages. If in Windows Explorer i double click on one of the index.html pages i see it has the correct content.
My issue
When I run my application with the following command as instructed by the sapper export, I see inconsistent behaviour.
npx serve __sapper__/export
It seems that to start off with when I do client side navigation and click on page1 link, I see the contents of my _error.svelte page or in a similar application i get a blank page. I do NOT the contents of the exported pages, i.e. page1 or page2 and the browser tab is showing a 500.
I do not understand why this would occur when I can see they exist in the export folder.
Other times when I try the same thing it works perfectly.
Does anyone else see inconsistent behaviour with sapper's export?
I am using the following versions
"sapper": "^0.28.0",
"svelte": "^3.17.3",
"svelte-loader": "^2.9.0",
I have also seen in another Svelte application of ours which has many more pages, that client side navigation causes the page to be generated. But yet the export has already generated that page, so how come all client side navigation is not serving up the exported page. It seems to me that export only serves up the first page and then every client navigation is built, which is a SSR site not a statically generated site