In SvelteKit one can configure whether routes should or should not have a trailing slash and this has relevance when it comes to relative urls. However, Svemix will throw an error if kit.config.trailingSlash: "always".
import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';
import svemix from 'svemix/plugin';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: preprocess(),
kit: {
adapter: adapter(),
target: '#svelte',
vite:
{
plugins: [svemix()]
},
trailingSlash: "always" // this line is the problem
}
};
export default config;
To test this, remember to delete the $__svemix__ directories after changing the config.
The error that one gets is An unknown error occured, which originates from load.ts.
I do not know for sure why this happens, but I have two speculative theories:
There is some string.split("/") action going on somewhere.
The kit.config.trailingSlash option messes with the generated Svemix files. In other words, when kit.config.trailingSlash: "always" one should search for the appropriate endpoint from a different location. This has most likely something to do with the endpoint index.ts files.
Explanation number two seems more probable, but I do not know for sure.
In SvelteKit one can configure whether routes should or should not have a trailing slash and this has relevance when it comes to relative urls. However, Svemix will throw an error if
kit.config.trailingSlash: "always"
.This config will work:
But this will not:
To test this, remember to delete the
$__svemix__
directories after changing the config.The error that one gets is
An unknown error occured
, which originates from load.ts.I do not know for sure why this happens, but I have two speculative theories:
string.split("/")
action going on somewhere.kit.config.trailingSlash
option messes with the generated Svemix files. In other words, whenkit.config.trailingSlash: "always"
one should search for the appropriate endpoint from a different location. This has most likely something to do with the endpointindex.ts
files.Explanation number two seems more probable, but I do not know for sure.