-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
59 lines (47 loc) · 1.26 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { defineConfig } from 'vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import { manifest } from './src/assets/manifest';
export default defineConfig({
build: {
target: 'ES2022',
sourcemap: true,
},
define: {
// https://vite-pwa-org.netlify.app/frameworks/sveltekit.html#generate-custom-service-worker
'process.env.NODE_ENV':
process.env.NODE_ENV === 'production' ? '"production"' : '"development"',
},
plugins: [
sveltekit(),
SvelteKitPWA({
// https://github.com/vite-pwa/sveltekit/blob/main/examples/sveltekit-ts/vite.config.ts
registerType: 'prompt',
strategies: 'injectManifest',
srcDir: 'src/workers',
filename: 'sw.ts',
// enable logs
mode: 'development',
devOptions: {
enabled: true,
type: 'module', // docs say this doesn't work in firefox even though it does
},
manifest,
includeAssets: ['favicon.ico', 'apple-touch-icon.png'],
workbox: {
sourcemap: true,
globPatterns: ['client/**/*.{html,css,js,ico,png,svg,webp,woff,woff2}'],
},
injectManifest: {
globPatterns: ['client/**/*.{html,css,js,ico,png,svg,webp,woff,woff2}'],
},
}),
],
server: {
port: 8000,
},
preview: {
port: 8000,
},
clearScreen: false,
});