@pieced/image-config-webpack-plugin
v1.0.5
Published
Automatically configuration webpack5 image loader
Downloads
2
Readme
Automatically configuration webpack5 image loader
Install
npm i --save-dev @pieced/image-config-webpack-plugin
Webpack Config
const ImageConfigWebpackPlugin = require('@pieced/image-config-webpack-plugin');
module.exports = {
plugins: [new ImageConfigWebpackPlugin()],
};
Options
suffix
type array
default ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp', 'avif']
parser
type object
- webpack.rule.parser
- default
const defaultParser = {
dataUrlCondition: {
maxSize: webpack.mode === 'development' ? undefined : 1000,
},
}
generator
type object
- webpack.rule.generator
- default
const defaultGenerator = {
filename: webpack.mode === 'development' ? '[path][name][ext]' : 'static/images/[contenthash:10][ext]',
}