73 lines
2.0 KiB
JavaScript
73 lines
2.0 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import eslintPlugin from 'vite-plugin-eslint'
|
|
import { pigment } from '@pigment-css/vite-plugin'
|
|
import { createTheme } from '@mui/material/styles'
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
// build into different folders depending on the `mode`.
|
|
const outDir = `./dist/${mode}/`
|
|
|
|
// Beispiel-Theme mit eigenen Farben und Einstellungen
|
|
const pigmentTheme = createTheme({
|
|
palette: {
|
|
primary: {
|
|
light: '#757ce8',
|
|
main: '#3f50b5',
|
|
dark: '#002884',
|
|
contrastText: '#fff',
|
|
},
|
|
secondary: {
|
|
light: '#ff7961',
|
|
main: '#f50057',
|
|
dark: '#c51162',
|
|
contrastText: '#000',
|
|
},
|
|
},
|
|
cssVariables: true, // wichtig für Pigment!
|
|
})
|
|
|
|
/**
|
|
* @type {import('@pigment-css/vite-plugin').PigmentOptions}
|
|
*/
|
|
const pigmentConfig = {
|
|
transformLibraries: ['@mui/material'],
|
|
theme: pigmentTheme,
|
|
}
|
|
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
pigment(pigmentConfig),
|
|
// TODO: aktivieren um linter beim build laufen zu lassen
|
|
// eslintPlugin({
|
|
// cache: false,
|
|
// include: ['./src/**/*.js', './src/**/*.jsx'],
|
|
// exclude: [],
|
|
// }),
|
|
],
|
|
build: {
|
|
sourcemap: true,
|
|
chunkSizeWarningLimit: 1500,
|
|
outDir,
|
|
// Optional: bessere Komprimierung für Produktion
|
|
minify: mode === 'production' ? 'esbuild' : false,
|
|
},
|
|
// Beispiel: Prefix für eigene Umgebungsvariablen
|
|
// envPrefix: 'MYAPP_',
|
|
|
|
// Optional: Alias für einfachere Imports
|
|
resolve: {
|
|
alias: {
|
|
'@': '/src',
|
|
},
|
|
},
|
|
|
|
// Optional: Server-Konfiguration für Entwicklung
|
|
server: {
|
|
port: 5173,
|
|
open: true,
|
|
},
|
|
}
|
|
})
|