Created
June 9, 2017 20:03
-
-
Save lgraubner/809b9c806c82366af34193ade5cfeb57 to your computer and use it in GitHub Desktop.
Webpack image processing sample configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpackConfig = { | |
entry: './app/index.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
loader: 'style-loader' | |
}, | |
{ | |
test: /.*\.(gif|png|jpe?g)$/i, | |
use: [ | |
{ | |
loader: 'url-loader', | |
options: { | |
limit: 8000, | |
name: '/images/[name]_[sha512:hash:base64:7].[ext]' | |
} | |
}, | |
{ | |
loader: 'image-webpack-loader', | |
options: { | |
optipng: { | |
optimizationLevel: 7 | |
}, | |
pngquant: { | |
quality: '65-90' | |
}, | |
mozjpeg: { | |
quality: 65 | |
} | |
} | |
} | |
] | |
} | |
] | |
} | |
}; | |
module.exports = webpackConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment