- Framer-motion aus Layout, NavLink, ContactInfo, LanguageSwitcher entfernt - PageTransition komplett vereinfacht (keine 1200ms Verzögerung mehr) - FloatingPaths wird erst nach 2s lazy geladen - Framer-motion und lucide-react in separate Chunks getrennt - Icons-Chunk: 10.87KB (statt 126KB ui-vendor) - Animations-Chunk wird erst bei Bedarf geladen Einsparung: ~115KB beim Initial Load 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
146 lines
3.6 KiB
TypeScript
146 lines
3.6 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
import mdx from '@mdx-js/rollup';
|
|
import remarkFrontmatter from 'remark-frontmatter';
|
|
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
{
|
|
...mdx({
|
|
remarkPlugins: [
|
|
remarkFrontmatter,
|
|
[remarkMdxFrontmatter, { name: 'frontmatter' }]
|
|
],
|
|
rehypePlugins: [],
|
|
providerImportSource: "@mdx-js/react"
|
|
}),
|
|
enforce: 'pre'
|
|
},
|
|
react({
|
|
// React Plugin Optimierungen
|
|
babel: {
|
|
babelrc: false,
|
|
configFile: false,
|
|
}
|
|
}),
|
|
VitePWA({
|
|
strategies: 'generateSW',
|
|
registerType: 'autoUpdate',
|
|
injectRegister: 'script-defer',
|
|
manifest: {
|
|
name: 'Damjan Savić - JTL Integration Expert',
|
|
short_name: 'Damjan Savić',
|
|
description: 'JTL Integration and E-commerce Solutions',
|
|
theme_color: '#000000',
|
|
background_color: '#000000',
|
|
display: 'standalone',
|
|
start_url: '/',
|
|
scope: '/',
|
|
icons: [
|
|
{
|
|
src: '/logo.svg',
|
|
sizes: '192x192',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any maskable'
|
|
},
|
|
{
|
|
src: '/logo.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any maskable'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,webp}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'google-fonts-cache',
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'gstatic-fonts-cache',
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
urlPattern: /^https:\/\/www\.googletagmanager\.com\/.*/i,
|
|
handler: 'NetworkOnly'
|
|
}
|
|
],
|
|
cleanupOutdatedCaches: true
|
|
},
|
|
devOptions: {
|
|
enabled: true,
|
|
type: 'module'
|
|
}
|
|
})
|
|
],
|
|
optimizeDeps: {
|
|
include: ['react/jsx-runtime'],
|
|
exclude: ['@mdx-js/react']
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': '/src'
|
|
}
|
|
},
|
|
css: {
|
|
devSourcemap: true,
|
|
preprocessorOptions: {
|
|
postcss: {
|
|
plugins: []
|
|
}
|
|
}
|
|
},
|
|
build: {
|
|
sourcemap: true,
|
|
cssCodeSplit: true,
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
drop_debugger: true
|
|
}
|
|
},
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
'mdx-vendor': ['@mdx-js/react'],
|
|
'i18n-vendor': ['i18next', 'react-i18next'],
|
|
'icons': ['lucide-react'],
|
|
'animations': ['framer-motion']
|
|
},
|
|
// Optimierte Asset-Dateinamen
|
|
assetFileNames: (assetInfo) => {
|
|
let extType = assetInfo.name.split('.').at(-1);
|
|
if (/webp|png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
|
|
extType = 'img';
|
|
}
|
|
return `assets/${extType}/[name]-[hash][extname]`;
|
|
},
|
|
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
hmr: {
|
|
overlay: false
|
|
}
|
|
}
|
|
}); |