mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-24 13:05:06 +00:00
perf: frontend performance optimizations (#1344)
This commit is contained in:
committed by
GitHub
parent
4d22c2dbcf
commit
6159e0bf96
@@ -2,28 +2,47 @@ import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import viteCompression from 'vite-plugin-compression';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
sveltekit(),
|
||||
tailwindcss(),
|
||||
paraglideVitePlugin({
|
||||
project: './project.inlang',
|
||||
outdir: './src/lib/paraglide',
|
||||
cookieName: 'locale',
|
||||
strategy: ['cookie', 'preferredLanguage', 'baseLocale']
|
||||
})
|
||||
],
|
||||
export default defineConfig((mode) => {
|
||||
return {
|
||||
plugins: [
|
||||
sveltekit(),
|
||||
tailwindcss(),
|
||||
paraglideVitePlugin({
|
||||
project: './project.inlang',
|
||||
outdir: './src/lib/paraglide',
|
||||
cookieName: 'locale',
|
||||
strategy: ['cookie', 'preferredLanguage', 'baseLocale']
|
||||
}),
|
||||
|
||||
server: {
|
||||
host: process.env.HOST,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
||||
},
|
||||
'/.well-known': {
|
||||
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
||||
// Create gzip-compressed files
|
||||
viteCompression({
|
||||
disable: mode.isPreview,
|
||||
algorithm: 'gzip',
|
||||
ext: '.gz',
|
||||
filter: /\.(js|mjs|json|css)$/i
|
||||
}),
|
||||
|
||||
// Create brotli-compressed files
|
||||
viteCompression({
|
||||
disable: mode.isPreview,
|
||||
algorithm: 'brotliCompress',
|
||||
ext: '.br',
|
||||
filter: /\.(js|mjs|json|css)$/i
|
||||
})
|
||||
],
|
||||
|
||||
server: {
|
||||
host: process.env.HOST,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
||||
},
|
||||
'/.well-known': {
|
||||
target: process.env.DEVELOPMENT_BACKEND_URL || 'http://localhost:1411'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user