2022-07-16 06:18:17 +02:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
|
|
import path from 'path';
|
|
|
|
|
2023-11-18 06:13:36 +02:00
|
|
|
const upstream = {
|
|
|
|
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:3001/',
|
|
|
|
secure: true,
|
|
|
|
changeOrigin: true,
|
2023-11-21 20:46:07 +02:00
|
|
|
logLevel: 'info',
|
2023-11-18 06:13:36 +02:00
|
|
|
ws: true,
|
|
|
|
};
|
|
|
|
|
2022-07-16 06:18:17 +02:00
|
|
|
/** @type {import('vite').UserConfig} */
|
|
|
|
const config = {
|
2023-07-01 06:50:47 +02:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
|
2024-01-01 19:36:49 +02:00
|
|
|
'@test-data': path.resolve(__dirname, './src/test-data'),
|
2023-07-01 06:50:47 +02:00
|
|
|
'@api': path.resolve('./src/api'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
// connect to a remote backend during web-only development
|
|
|
|
proxy: {
|
2023-11-18 06:13:36 +02:00
|
|
|
'/api': upstream,
|
|
|
|
'/.well-known/immich': upstream,
|
|
|
|
'/custom.css': upstream,
|
2023-07-01 06:50:47 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [sveltekit()],
|
2023-10-07 12:49:34 +02:00
|
|
|
optimizeDeps: {
|
2023-11-07 06:02:46 +02:00
|
|
|
entries: ['src/**/*.{svelte,ts,html}'],
|
2023-10-07 12:49:34 +02:00
|
|
|
},
|
2022-07-16 06:18:17 +02:00
|
|
|
};
|
|
|
|
|
2024-01-01 19:36:49 +02:00
|
|
|
/** @type {import('vitest').UserConfig} */
|
|
|
|
const 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' }],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default { ...config, test };
|