I use vite-plugin-mkcert for a HTTPS dev server with vite/sveltekit. This plugin handles the certification for you. See npmjs.com/vite-plugin-mkcert
Your vite.config.ts should contain these options:
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import mkcert from 'vite-plugin-mkcert';
export default defineConfig({
plugins: [
sveltekit(),
mkcert()
],
server: {
https: {},
proxy: {}, // workaround to get dev server working
}
});
I believe others have given answers regarding the secure cookies, but there is also some documentation for working with mobile devices on the plugin page linked earlier.