diff --git a/src/pages/artikel/kategorien.jsx b/src/pages/artikel/kategorien.jsx index fc9dd8f..0c670fa 100644 --- a/src/pages/artikel/kategorien.jsx +++ b/src/pages/artikel/kategorien.jsx @@ -10,6 +10,7 @@ import CategoryPickerDialog from '../../components/article/CategoryPickerDialog' import { NewCategoryTile, CategoryBreadcrumbs } from '../../components/category'; import { NewArticleTile } from '../../components/article'; import { notifyError } from '../../utils/notify'; +import { prepareArticlePhoto } from '../../utils/prepareArticlePhoto'; import { ArticleTile, BackTile, @@ -440,7 +441,6 @@ class ArtikelKategorienPage extends PureComponent { const file = e.target.files?.[0]; if (!file) return; try { - const { prepareArticlePhoto } = await import('../../utils/prepareArticlePhoto'); const avifFile = await prepareArticlePhoto(file); await categoryAutomat.actions.uploadCategoryImage({ categoryId: item.id, diff --git a/vite.config.js b/vite.config.js index 7cc08f7..048c23d 100644 --- a/vite.config.js +++ b/vite.config.js @@ -162,24 +162,62 @@ export default defineConfig(({ command }) => ({ output: { codeSplitting: { groups: [ + // Split the lazy routes into a handful of per-section chunks + // (not one tiny chunk per route). Each section chunk groups the + // section's pages together with the component trees used only by + // that section, so first navigation to /artikel, /auftrag, … + // loads just that section's code. Modules shared across sections + // (api/, automats/, utils/, generic components/) fall out into a + // common chunk by the bundler automatically. { - // Consolidate every lazy(() => import('./pages/...')) route - // module into ONE chunk so we don't ship ~30 tiny 0.1–0.4 kB - // files. Still loaded on first route navigation (not on the - // initial bundle). For per-section chunks instead, replace this - // with groups matching /\/src\/pages\/(artikel|lieferung|...)\//. - name: 'routes', - test: /\/src\/pages\//, + // Artikel section: pages + its dedicated component trees. + name: 'routes-artikel', + test: /\/src\/(pages\/artikel|components\/(article|category|tiles))\//, }, { + // Delivery + order (auftrag) editor surfaces share these. + name: 'routes-manifest', + test: /\/src\/components\/manifest\//, + }, + { + name: 'routes-auftrag', + test: /\/src\/pages\/auftrag\//, + }, + { + name: 'routes-lieferung', + test: /\/src\/pages\/lieferung\//, + }, + { + name: 'routes-kunde', + test: /\/src\/pages\/kunde\//, + }, + { + priority: 110, + name: 'router-vendor', + test: /node_modules\/(react-router|react-router-dom)\//, + }, + { + priority: 100, name: 'react-vendor', - test: /node_modules\/(react|react-dom|react-router|react-router-dom|scheduler)\//, + test: /node_modules\/(react|react-dom|scheduler)\//, }, { + priority: 110, + name: 'mui-icons', + test: /node_modules\/@mui\/icons-material\//, + }, + { + priority: 105, + name: 'emotion-vendor', + test: /node_modules\/@emotion\//, + }, + { + priority: 100, name: 'mui-vendor', - test: /node_modules\/(@mui|@emotion)\//, + test: /node_modules\/@mui\//, }, { + priority: 100, name: 'jsquash-image', test: /node_modules\/@jsquash\/(avif|resize)\//, },