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