2024-02-18 21:18:40 +02:00
|
|
|
import { enhancedImages } from '@sveltejs/enhanced-img';
|
2022-07-16 06:18:17 +02:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
2024-11-02 17:49:07 +02:00
|
|
|
import { svelteTesting } from '@testing-library/svelte/vite';
|
2024-02-14 17:54:32 +02:00
|
|
|
import path from 'node:path';
|
2024-02-08 09:27:54 +02:00
|
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
|
import { defineConfig } from 'vite';
|
2022-07-16 06:18:17 +02:00
|
|
|
|
2023-11-18 06:13:36 +02:00
|
|
|
const upstream = {
|
2024-10-09 22:01:52 +02:00
|
|
|
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:2283/',
|
2023-11-18 06:13:36 +02:00
|
|
|
secure: true,
|
|
|
|
changeOrigin: true,
|
2023-11-21 20:46:07 +02:00
|
|
|
logLevel: 'info',
|
2023-11-18 06:13:36 +02:00
|
|
|
ws: true,
|
|
|
|
};
|
|
|
|
|
2024-02-08 09:27:54 +02:00
|
|
|
export default defineConfig({
|
2023-07-01 06:50:47 +02:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
|
2024-02-02 05:18:00 +02:00
|
|
|
// eslint-disable-next-line unicorn/prefer-module
|
2024-01-01 19:36:49 +02:00
|
|
|
'@test-data': path.resolve(__dirname, './src/test-data'),
|
2023-07-01 06:50:47 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
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
|
|
|
},
|
|
|
|
},
|
2024-02-08 09:27:54 +02:00
|
|
|
plugins: [
|
|
|
|
sveltekit(),
|
2024-04-26 21:36:30 +02:00
|
|
|
process.env.BUILD_STATS === 'true'
|
|
|
|
? visualizer({
|
|
|
|
emitFile: true,
|
|
|
|
filename: 'stats.html',
|
|
|
|
})
|
|
|
|
: undefined,
|
2024-02-18 21:18:40 +02:00
|
|
|
enhancedImages(),
|
2024-11-02 17:49:07 +02:00
|
|
|
svelteTesting(),
|
2024-02-08 09:27:54 +02:00
|
|
|
],
|
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
|
|
|
},
|
2024-02-08 09:27:54 +02:00
|
|
|
test: {
|
|
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
|
|
globals: true,
|
|
|
|
environment: 'jsdom',
|
|
|
|
setupFiles: ['./src/test-data/setup.ts'],
|
|
|
|
sequence: {
|
|
|
|
hooks: 'list',
|
|
|
|
},
|
2024-01-01 19:36:49 +02:00
|
|
|
},
|
2024-02-08 09:27:54 +02:00
|
|
|
});
|