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:
@@ -132,6 +132,8 @@ class Images extends Component {
|
|||||||
component="img"
|
component="img"
|
||||||
height="400"
|
height="400"
|
||||||
image={getImagePath(this.props.pictureList)}
|
image={getImagePath(this.props.pictureList)}
|
||||||
|
fetchPriority="high"
|
||||||
|
loading="eager"
|
||||||
sx={{
|
sx={{
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -170,6 +172,8 @@ class Images extends Component {
|
|||||||
<CardMedia
|
<CardMedia
|
||||||
component="img"
|
component="img"
|
||||||
height="400"
|
height="400"
|
||||||
|
fetchPriority="high"
|
||||||
|
loading="eager"
|
||||||
sx={{
|
sx={{
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import {
|
|||||||
Grid,
|
Grid,
|
||||||
Alert
|
Alert
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import {
|
import Delete from '@mui/icons-material/Delete';
|
||||||
Delete,
|
import CloudUpload from '@mui/icons-material/CloudUpload';
|
||||||
CloudUpload
|
|
||||||
} from '@mui/icons-material';
|
|
||||||
|
|
||||||
class PhotoUpload extends Component {
|
class PhotoUpload extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|||||||
@@ -306,6 +306,8 @@ class Product extends Component {
|
|||||||
height={ window.innerWidth < 600 ? "240" : "180" }
|
height={ window.innerWidth < 600 ? "240" : "180" }
|
||||||
image="/assets/images/nopicture.jpg"
|
image="/assets/images/nopicture.jpg"
|
||||||
alt={name}
|
alt={name}
|
||||||
|
fetchPriority={this.props.priority === 'high' ? 'high' : 'auto'}
|
||||||
|
loading={this.props.priority === 'high' ? 'eager' : 'lazy'}
|
||||||
sx={{
|
sx={{
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
borderTopLeftRadius: '8px',
|
borderTopLeftRadius: '8px',
|
||||||
@@ -319,6 +321,8 @@ class Product extends Component {
|
|||||||
height={ window.innerWidth < 600 ? "240" : "180" }
|
height={ window.innerWidth < 600 ? "240" : "180" }
|
||||||
image={this.state.image}
|
image={this.state.image}
|
||||||
alt={name}
|
alt={name}
|
||||||
|
fetchPriority={this.props.priority === 'high' ? 'high' : 'auto'}
|
||||||
|
loading={this.props.priority === 'high' ? 'eager' : 'lazy'}
|
||||||
sx={{
|
sx={{
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
borderTopLeftRadius: '8px',
|
borderTopLeftRadius: '8px',
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ const ProductImage = ({
|
|||||||
height="400"
|
height="400"
|
||||||
image="/assets/images/nopicture.jpg"
|
image="/assets/images/nopicture.jpg"
|
||||||
alt={product.name}
|
alt={product.name}
|
||||||
|
fetchPriority="high"
|
||||||
|
loading="eager"
|
||||||
sx={{ objectFit: "cover" }}
|
sx={{ objectFit: "cover" }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -476,6 +476,7 @@ class ProductList extends Component {
|
|||||||
pictureList={product.pictureList}
|
pictureList={product.pictureList}
|
||||||
availableSupplier={product.availableSupplier}
|
availableSupplier={product.availableSupplier}
|
||||||
komponenten={product.komponenten}
|
komponenten={product.komponenten}
|
||||||
|
priority={index < 6 ? 'high' : 'auto'}
|
||||||
t={this.props.t}
|
t={this.props.t}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
IconButton,
|
IconButton,
|
||||||
Snackbar
|
Snackbar
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { ContentCopy } from '@mui/icons-material';
|
import ContentCopy from '@mui/icons-material/ContentCopy';
|
||||||
import { withI18n } from '../../i18n/withTranslation.js';
|
import { withI18n } from '../../i18n/withTranslation.js';
|
||||||
|
|
||||||
class SettingsTab extends Component {
|
class SettingsTab extends Component {
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ import {
|
|||||||
ListItemText,
|
ListItemText,
|
||||||
ListItemSecondaryAction,
|
ListItemSecondaryAction,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import {
|
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
|
||||||
ShoppingCart as ShoppingCartIcon,
|
|
||||||
} from '@mui/icons-material';
|
|
||||||
import { TentShapeSelector, ProductSelector, ExtrasSelector } from '../components/configurator/index.js';
|
import { TentShapeSelector, ProductSelector, ExtrasSelector } from '../components/configurator/index.js';
|
||||||
import { tentShapes, tentSizes, lightTypes, ventilationTypes, extras } from '../data/configuratorData.js';
|
import { tentShapes, tentSizes, lightTypes, ventilationTypes, extras } from '../data/configuratorData.js';
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// Split commonly used MUI icons (used in main bundle and immediate-loading components)
|
// Split commonly used MUI icons (used in main bundle and immediate-loading components)
|
||||||
muiIconsCommon: {
|
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',
|
name: 'mui-icons-common',
|
||||||
priority: 29,
|
priority: 29,
|
||||||
reuseExistingChunk: true,
|
reuseExistingChunk: true,
|
||||||
@@ -231,7 +231,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// Split remaining MUI icons into separate chunk (for lazy-loaded components only)
|
// Split remaining MUI icons into separate chunk (for lazy-loaded components only)
|
||||||
muiIcons: {
|
muiIcons: {
|
||||||
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/]/,
|
test: /[\\/]node_modules[\\/]@mui[\\/]icons-material[\\/].*(Article|LockReset|AdminPanelSettings|Group|BarChart).*\.js$/,
|
||||||
name: 'mui-icons',
|
name: 'mui-icons',
|
||||||
priority: 28,
|
priority: 28,
|
||||||
reuseExistingChunk: true,
|
reuseExistingChunk: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user