Install Vite with Svelte template:
npm create vite@latest vite-svelte-pwa -- --template svelte
cd vite-svelte-pwa
pnpm i
pnpm i -D gh-pages
"scripts": {
"dev": "vite",
"build": "vite build && cp service-worker.js CNAME ./dist ",
"preview": "vite preview",
"deploy": "npx gh-pages -d dist"
},
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
build: {
assetsInlineLimit: 0, // 0 means all files will be inlined
},
})
npm run build && npm run deploy