Install Imagemin plugin for Webpack
npm install imagemin-webpack-plugin
Update webpack.mix.js
// Add near top of file
let ImageminPlugin = require( 'imagemin-webpack-plugin' ).default;
mix.webpackConfig( {
plugins: [
new ImageminPlugin( {
// disable: process.env.NODE_ENV !== 'production', // Disable during development
pngquant: {
quality: '95-100',
},
test: /\.(jpe?g|png|gif|svg)$/i,
} ),
],
} )
and copy over the image files
mix.copy( 'resources/assets/images', 'public/images', false );