mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-05-03 19:40:30 +00:00
e0c5511238
Release Please / release-please (push) Has been cancelled
Release Preview / call-reusable-release (push) Has been cancelled
Test / test-nix (push) Has been cancelled
Test / test-win (push) Has been cancelled
Update Restic / update-restic-version (push) Has been cancelled
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
|
import { defineConfig, loadEnv, type PluginOption } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
import viteCompression from 'vite-plugin-compression';
|
|
// import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
|
|
return {
|
|
plugins: [
|
|
paraglideVitePlugin({
|
|
project: './project.inlang',
|
|
outdir: './src/paraglide',
|
|
strategy: ['localStorage', 'preferredLanguage', 'baseLocale'],
|
|
}),
|
|
react(),
|
|
tsconfigPaths(),
|
|
viteCompression({ algorithm: 'gzip', ext: '.gz', deleteOriginFile: true }),
|
|
// viteCompression({ algorithm: 'brotliCompress', ext: '.br' }),
|
|
// visualizer({
|
|
// open: false,
|
|
// gzipSize: true,
|
|
// // brotliSize: true,
|
|
// }) as PluginOption,
|
|
],
|
|
base: './',
|
|
build: {
|
|
outDir: 'dist',
|
|
target: 'esnext',
|
|
minify: 'esbuild',
|
|
},
|
|
define: {
|
|
'process.env.UI_OS': JSON.stringify(env.UI_OS),
|
|
'process.env.BACKREST_BUILD_VERSION': JSON.stringify(env.BACKREST_BUILD_VERSION),
|
|
'process.env.UI_BACKEND_URL': JSON.stringify(env.UI_BACKEND_URL),
|
|
'process.env.UI_FEATURES': JSON.stringify(env.UI_FEATURES),
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/v1.Backrest': {
|
|
target: env.UI_BACKEND_URL || 'http://localhost:9898',
|
|
secure: false,
|
|
},
|
|
'/v1.Authentication': {
|
|
target: env.UI_BACKEND_URL || 'http://localhost:9898',
|
|
secure: false,
|
|
},
|
|
'/download': {
|
|
target: env.UI_BACKEND_URL || 'http://localhost:9898',
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|