2025-03-20 19:57:41 +01:00
|
|
|
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
2024-08-12 11:00:25 +02:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
2025-01-27 10:21:11 +01:00
|
|
|
import tailwindcss from '@tailwindcss/vite';
|
2024-08-12 11:00:25 +02:00
|
|
|
import { defineConfig } from 'vite';
|
2026-03-01 13:04:38 -08:00
|
|
|
import viteCompression from 'vite-plugin-compression';
|
2024-08-12 11:00:25 +02:00
|
|
|
|
2026-03-01 13:04:38 -08:00
|
|
|
export default defineConfig((mode) => {
|
|
|
|
|
return {
|
|
|
|
|
plugins: [
|
|
|
|
|
sveltekit(),
|
|
|
|
|
tailwindcss(),
|
|
|
|
|
paraglideVitePlugin({
|
|
|
|
|
project: './project.inlang',
|
|
|
|
|
outdir: './src/lib/paraglide',
|
|
|
|
|
cookieName: 'locale',
|
|
|
|
|
strategy: ['cookie', 'preferredLanguage', 'baseLocale']
|
|
|
|
|
}),
|
2025-05-17 00:36:58 +02:00
|
|
|
|
2026-03-01 13:04:38 -08:00
|
|
|
// Create gzip-compressed files
|
|
|
|
|
viteCompression({
|
|
|
|
|
disable: mode.isPreview,
|
|
|
|
|
algorithm: 'gzip',
|
|
|
|
|
ext: '.gz',
|
2026-04-21 11:55:43 -05:00
|
|
|
filter: /\.(js|mjs|json|css)$/i
|
2026-03-01 13:04:38 -08:00
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
// Create brotli-compressed files
|
|
|
|
|
viteCompression({
|
|
|
|
|
disable: mode.isPreview,
|
|
|
|
|
algorithm: 'brotliCompress',
|
|
|
|
|
ext: '.br',
|
2026-04-21 11:55:43 -05:00
|
|
|
filter: /\.(js|mjs|json|css)$/i
|
2026-03-01 13:04:38 -08:00
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
server: {
|
|
|
|
|
host: process.env.HOST,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
|
|
|
|
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
|
|
|
|
},
|
2026-07-05 14:14:39 -07:00
|
|
|
'/internal': {
|
|
|
|
|
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
|
|
|
|
},
|
2026-03-01 13:04:38 -08:00
|
|
|
'/.well-known': {
|
|
|
|
|
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
2026-06-22 18:42:02 +02:00
|
|
|
},
|
|
|
|
|
'^/authorize(?:\\?.*)?$': {
|
|
|
|
|
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
2026-03-01 13:04:38 -08:00
|
|
|
}
|
2025-05-17 00:36:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-03-01 13:04:38 -08:00
|
|
|
};
|
2024-08-12 11:00:25 +02:00
|
|
|
});
|