imagemin-webpack-plugin

1、npm install imagemin-webpack-plugin

2、const ImageminPlugin = require('imagemin-webpack-plugin').default

3、在webpack.base.conf使用

        module.exports = {

            plugins: [

            // Make sure that the plugin is after any plugins that add images new ImageminPlugin

                ({

                    disable: process.env.NODE_ENV !== 'production',

                     pngquant: {

                        quality: '95-100'

                    }

                })

    ] }

参考链接:https://github.com/Klathmon/imagemin-webpack-plugin

猜你喜欢

转载自my.oschina.net/u/3705266/blog/1821014