2023-09-11 05:49:56 +08:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
|
|
import { defineConfig } from 'vite';
|
2023-10-13 12:45:28 +08:00
|
|
|
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
|
2023-09-11 05:49:56 +08:00
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [
|
|
|
|
sveltekit(),
|
|
|
|
{
|
|
|
|
name: 'configure-response-headers',
|
|
|
|
configureServer: (server) => {
|
|
|
|
server.middlewares.use((_req, res, next) => {
|
|
|
|
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
|
|
|
|
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2023-10-13 12:45:28 +08:00
|
|
|
SvelteKitPWA({
|
|
|
|
strategies: 'generateSW',
|
|
|
|
registerType: 'prompt',
|
|
|
|
manifest: false,
|
|
|
|
workbox: {
|
|
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,ttf,wasm}'],
|
|
|
|
globIgnores: ['**/apple-splash-*'],
|
|
|
|
maximumFileSizeToCacheInBytes: 5000000,
|
|
|
|
},
|
|
|
|
}),
|
2023-09-11 05:49:56 +08:00
|
|
|
],
|
2023-09-11 06:14:54 +08:00
|
|
|
build: {
|
|
|
|
target: 'esnext',
|
|
|
|
},
|
2023-09-11 05:49:56 +08:00
|
|
|
optimizeDeps: {
|
|
|
|
exclude: ['sqlocal', 'bytemd'],
|
|
|
|
},
|
|
|
|
});
|