2022-07-16 04:18:17 +00:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
2024-02-08 07:27:54 +00:00
|
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
|
import { defineConfig } from 'vite';
|
2024-02-02 03:18:00 +00:00
|
|
|
import path from 'node:path';
|
2022-07-16 04:18:17 +00:00
|
|
|
|
2023-11-18 04:13:36 +00:00
|
|
|
const upstream = {
|
|
|
|
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:3001/',
|
|
|
|
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(),
|
|
|
|
visualizer({
|
|
|
|
emitFile: true,
|
|
|
|
filename: 'stats.html',
|
|
|
|
}),
|
|
|
|
],
|
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',
|
|
|
|
},
|
|
|
|
alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }],
|
2024-01-01 17:36:49 +00:00
|
|
|
},
|
2024-02-08 07:27:54 +00:00
|
|
|
});
|