can you show a sample webpackconfig?
See original GitHub issueBelow is my settings but its not compressing png,jpg even i set the optimizationLevel to any number.
it would really be helpful if you can show a sample of the whole config with how to optimizationLevel.
sorry im a noob in webpack
const { ImageminWebpackPlugin } = require("imagemin-webpack");
const imageminGifsicle = require("imagemin-gifsicle");
const imageminOptipng = require('imagemin-optipng');
const imageminJpegtran = require('imagemin-jpegtran');
module.exports = {
entry: {
home: './src/js/home.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].bundle.js'
},
module: {
rules: [
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [
'file-loader?name=[name].[ext]&outputPath=images/&publicPath=images/',
]
}
]
},
plugins: [
new HtmlWebPackPlugin({
title: 'Custom template',
template: path.join(__dirname, 'src', 'index.html'),
excludeChunks: ['about'],
hash: true,
}),
new ImageminWebpackPlugin({
imageminOptions: {
plugins: [
imageminGifsicle({
interlaced: true,
optimizationLevel: 3
}),
imageminOptipng({
interlaced: true,
optimizationLevel: 3
}),
imageminJpegtran({
progressive: true,
optimizationLevel: 3
})
]
},
name: "[name]-[hash].[ext]",
test: /\.(jpe?g|png|gif|svg)$/i
})
]
}```
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Configuration - webpack
This configuration is then processed by webpack based upon its defined properties. Because it's a standard Node.js CommonJS module, you can do the...
Read more >All You Need to Know about Webpack in Examples - Medium
This article will cover all main ideas behind the webpack — module bundler. You will know how to configure webpack, add assets, ...
Read more >How to Create a Production-Ready Webpack 4 Config From ...
Typically, webpack is configured when a project is first set up, and small tweaks are then made to the config files as needed...
Read more >Example Webpack Config File - gists · GitHub
Dependencies and Configuration (Old setup, below Webpack v4). An example Webpack config file with a handful of handy add-ons/plugins.
Read more >6 ways to configure Webpack - DEV Community
As of webpack version 4, you are not required to specify a configuration. By default, webpack assumes that your code starts at src/index.js...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ronjb04
CopyWebpackPlugin
pluginhttps://github.com/itgalaxy/imagemin-webpack#usage
imagemin-svgo
From docs
npm install imagemin-gifsicle imagemin-jpegtran imagemin-optipng imagemin-svgo --save-dev
imagemin-mozjpeg
he lossy compression (i.e. lowers the quality of images).Compression images can be in
lossy
mode (lowers the quality of images) andlossless
(without lowers the quality of images). I documented basic preset in readme https://github.com/itgalaxy/imagemin-webpack#optionals@ronjb04 feel free to feedback