2024-02-18 12:18:40 -07:00
|
|
|
import { enhancedImages } from '@sveltejs/enhanced-img';
|
2022-07-15 21:18:17 -07:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
2024-02-14 08:54:32 -07:00
|
|
|
import path from 'node:path';
|
2024-02-08 00:27:54 -07:00
|
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
|
import { defineConfig } from 'vite';
|
2022-07-15 21:18:17 -07:00
|
|
|
|
2023-11-17 21:13:36 -07:00
|
|
|
const upstream = {
|
|
|
|
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:3001/',
|
|
|
|
secure: true,
|
|
|
|
changeOrigin: true,
|
2023-11-21 11:46:07 -07:00
|
|
|
logLevel: 'info',
|
2023-11-17 21:13:36 -07:00
|
|
|
ws: true,
|
|
|
|
};
|
|
|
|
|
2024-02-08 00:27:54 -07:00
|
|
|
export default defineConfig({
|
2023-06-30 21:50:47 -07:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
|
2024-02-01 20:18:00 -07:00
|
|
|
// eslint-disable-next-line unicorn/prefer-module
|
2024-01-01 10:36:49 -07:00
|
|
|
'@test-data': path.resolve(__dirname, './src/test-data'),
|
2023-06-30 21:50:47 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
// connect to a remote backend during web-only development
|
|
|
|
proxy: {
|
2023-11-17 21:13:36 -07:00
|
|
|
'/api': upstream,
|
|
|
|
'/.well-known/immich': upstream,
|
|
|
|
'/custom.css': upstream,
|
2023-06-30 21:50:47 -07:00
|
|
|
},
|
|
|
|
},
|
2024-02-08 00:27:54 -07:00
|
|
|
plugins: [
|
|
|
|
sveltekit(),
|
|
|
|
visualizer({
|
|
|
|
emitFile: true,
|
|
|
|
filename: 'stats.html',
|
|
|
|
}),
|
2024-02-18 12:18:40 -07:00
|
|
|
enhancedImages(),
|
2024-02-08 00:27:54 -07:00
|
|
|
],
|
2023-10-07 03:49:34 -07:00
|
|
|
optimizeDeps: {
|
2023-11-06 21:02:46 -07:00
|
|
|
entries: ['src/**/*.{svelte,ts,html}'],
|
2023-10-07 03:49:34 -07:00
|
|
|
},
|
2024-02-08 00:27:54 -07:00
|
|
|
test: {
|
|
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
|
|
globals: true,
|
|
|
|
environment: 'jsdom',
|
|
|
|
setupFiles: ['./src/test-data/setup.ts'],
|
|
|
|
sequence: {
|
|
|
|
hooks: 'list',
|
|
|
|
},
|
|
|
|
alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }],
|
2024-01-01 10:36:49 -07:00
|
|
|
},
|
2024-02-08 00:27:54 -07:00
|
|
|
});
|