-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.config.ts
More file actions
56 lines (54 loc) · 1.44 KB
/
vite.config.ts
File metadata and controls
56 lines (54 loc) · 1.44 KB
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
import devtoolsJson from 'vite-plugin-devtools-json';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import type { ManifestOptions } from 'vite-plugin-pwa';
import { sitemapPlugin } from 'sveltekit-sitemap/dist/plugin.js';
import rawManifest from './static/manifest.json';
const manifest = rawManifest as Partial<ManifestOptions>;
export default defineConfig(({ mode }) => {
const isDevelopment = mode === 'development';
return {
resolve: {
dedupe: ['svelte']
},
plugins: [
sveltekit(),
// Disable PWA in dev to avoid SW interfering with HMR
!isDevelopment &&
SvelteKitPWA({
registerType: 'autoUpdate',
manifest,
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,jpg,jpeg,gif,webp,woff,woff2,ttf,eot}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/play\.maple\.music\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
networkTimeoutSeconds: 10,
cacheableResponse: { statuses: [0, 200] }
}
}
]
},
devOptions: { enabled: false }
}),
!isDevelopment &&
sitemapPlugin({
routesDir: './src/routes',
sitemapFile: './src/sitemap.ts'
}),
!isDevelopment && devtoolsJson()
].filter(Boolean),
optimizeDeps: {
exclude: ['svelte']
},
server: {
watch: {
usePolling: true
}
}
};
});