Cockatrice/webclient/vite.config.ts
2026-05-07 15:54:59 -05:00

93 lines
2.5 KiB
TypeScript

import { fileURLToPath } from 'node:url';
import path from 'node:path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const srcPath = (...segments: string[]) => path.resolve(__dirname, 'src', ...segments);
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@app/api': srcPath('api/index.ts'),
'@app/components': srcPath('components/index.ts'),
'@app/containers': srcPath('containers/index.ts'),
'@app/dialogs': srcPath('dialogs/index.ts'),
'@app/forms': srcPath('forms/index.ts'),
'@app/hooks': srcPath('hooks/index.ts'),
'@app/images': srcPath('images/index.ts'),
'@app/services': srcPath('services/index.ts'),
'@app/store': srcPath('store/index.ts'),
'@app/types': srcPath('types/index.ts'),
'@app/utils': srcPath('utils/index.ts'),
'@app/websocket/types': 'sockatrice/types',
'@app/websocket': 'sockatrice',
'@app/generated': 'sockatrice/generated',
},
},
optimizeDeps: {
include: [
'@mui/material',
'@mui/material/styles',
'@mui/icons-material',
'@emotion/react',
'@emotion/styled',
'@dnd-kit/core',
'@dnd-kit/utilities',
'@reduxjs/toolkit',
'react-redux',
'react',
'react-dom',
'react-dom/client',
'react/jsx-runtime',
'react-router-dom',
'i18next',
'react-i18next',
'@testing-library/react',
'@testing-library/jest-dom/vitest',
'@bufbuild/protobuf',
'sockatrice',
'sockatrice/types',
'sockatrice/generated',
],
},
publicDir: 'public',
build: {
outDir: 'build',
},
server: {
open: true,
watch: {
ignored: ['build', 'coverage', 'integration']
}
},
test: {
globals: true,
environment: 'jsdom',
server: {
deps: {
inline: ['sockatrice'],
},
},
setupFiles: ['./src/setupTests.ts'],
include: ['src/**/*.spec.{ts,tsx}'],
exclude: ['node_modules', 'build', 'integration', 'coverage'],
isolate: true,
pool: 'threads',
maxWorkers: 4,
testTimeout: 10000,
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
reportsDirectory: './coverage/testing',
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/**/*.spec.{ts,tsx}',
'src/**/__mocks__/**',
'src/setupTests.ts',
'src/polyfills.ts',
],
},
},
});