mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-07-27 20:31:29 +00:00
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
|
import { defineConfig, loadEnv } 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',
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes('node_modules')) return;
|
|
if (id.includes('/recharts/') || id.includes('/d3-') || id.includes('/victory-vendor/'))
|
|
return 'vendor-recharts';
|
|
},
|
|
},
|
|
},
|
|
},
|
|
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,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|