feat: enhance image loading performance by adding fetchPriority and loading attributes in multiple components, and update MUI icons chunking in webpack configuration

This commit is contained in:
sebseb7
2025-07-20 15:05:29 +02:00
parent d3998133e5
commit a68d912c99
8 changed files with 17 additions and 10 deletions

View File

@@ -132,6 +132,8 @@ class Images extends Component {
component="img"
height="400"
image={getImagePath(this.props.pictureList)}
fetchPriority="high"
loading="eager"
sx={{
objectFit: 'contain',
cursor: 'pointer',
@@ -170,6 +172,8 @@ class Images extends Component {
<CardMedia
component="img"
height="400"
fetchPriority="high"
loading="eager"
sx={{
objectFit: 'contain',
cursor: 'pointer',

View File

@@ -8,10 +8,8 @@ import {
Grid,
Alert
} from '@mui/material';
import {
Delete,
CloudUpload
} from '@mui/icons-material';
import Delete from '@mui/icons-material/Delete';
import CloudUpload from '@mui/icons-material/CloudUpload';
class PhotoUpload extends Component {
constructor(props) {

View File

@@ -306,6 +306,8 @@ class Product extends Component {
height={ window.innerWidth < 600 ? "240" : "180" }
image="/assets/images/nopicture.jpg"
alt={name}
fetchPriority={this.props.priority === 'high' ? 'high' : 'auto'}
loading={this.props.priority === 'high' ? 'eager' : 'lazy'}
sx={{
objectFit: 'contain',
borderTopLeftRadius: '8px',
@@ -319,6 +321,8 @@ class Product extends Component {
height={ window.innerWidth < 600 ? "240" : "180" }
image={this.state.image}
alt={name}
fetchPriority={this.props.priority === 'high' ? 'high' : 'auto'}
loading={this.props.priority === 'high' ? 'eager' : 'lazy'}
sx={{
objectFit: 'contain',
borderTopLeftRadius: '8px',

View File

@@ -31,6 +31,8 @@ const ProductImage = ({
height="400"
image="/assets/images/nopicture.jpg"
alt={product.name}
fetchPriority="high"
loading="eager"
sx={{ objectFit: "cover" }}
/>
)}

View File

@@ -476,6 +476,7 @@ class ProductList extends Component {
pictureList={product.pictureList}
availableSupplier={product.availableSupplier}
komponenten={product.komponenten}
priority={index < 6 ? 'high' : 'auto'}
t={this.props.t}
/>
</Grid>

View File

@@ -11,7 +11,7 @@ import {
IconButton,
Snackbar
} from '@mui/material';
import { ContentCopy } from '@mui/icons-material';
import ContentCopy from '@mui/icons-material/ContentCopy';
import { withI18n } from '../../i18n/withTranslation.js';
class SettingsTab extends Component {

View File

@@ -11,9 +11,7 @@ import {
ListItemText,
ListItemSecondaryAction,
} from '@mui/material';
import {
ShoppingCart as ShoppingCartIcon,
} from '@mui/icons-material';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { TentShapeSelector, ProductSelector, ExtrasSelector } from '../components/configurator/index.js';
import { tentShapes, tentSizes, lightTypes, ventilationTypes, extras } from '../data/configuratorData.js';

View File

@@ -223,7 +223,7 @@ export default {
},
// Split commonly used MUI icons (used in main bundle and immediate-loading components)
muiIconsCommon: {
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/].*(SmartToy|Palette|Search|Home|ShoppingCart|Close|ChevronLeft|ChevronRight|Person|Google|Add|Remove|Delete|KeyboardArrowUp|ZoomIn|Loupe|ExpandMore|ExpandLess|Mic|Stop|PhotoCamera).*\.js$/,
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/].*(SmartToy|Palette|Search|Home|ShoppingCart|Close|ChevronLeft|ChevronRight|Person|Google|Add|Remove|Delete|KeyboardArrowUp|ZoomIn|Loupe|ExpandMore|ExpandLess|Mic|Stop|PhotoCamera|Menu|KeyboardReturn|ContentCopy|Cancel|CloudUpload|Star).*\.js$/,
name: 'mui-icons-common',
priority: 29,
reuseExistingChunk: true,
@@ -231,7 +231,7 @@ export default {
},
// Split remaining MUI icons into separate chunk (for lazy-loaded components only)
muiIcons: {
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/]/,
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/].*(Article|LockReset|AdminPanelSettings|Group|BarChart).*\.js$/,
name: 'mui-icons',
priority: 28,
reuseExistingChunk: true,