SvelteKit page keeps on reloading page every 3-4s when serving localhost on https

Here is the issue related to this https://github.com/sveltejs/kit/issues/844

To serve localhost on https, solution is to override the protocol in your svelte kit configuration file

kit: {
        adapter: adapter(),
        vite: {
            server: {
                hmr: {
                    protocol: 'ws',
                }
            }
        },
        // hydrate the <div id="svelte"> element in src/app.html
        target: '#svelte'
    }