You can achieve this by adding a library that supports css minify to "webpack.config.js". In this snippet I use "optimize-css-assets-webpack-plugin" which uses cssnano for minimizing by default. The "safe" parameter is set so the output css would not reset z-indexes.
Source code viewer
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); if (process.env.NODE_ENV === 'production') { config.plugins.push( new ExtractTextPlugin('styles.css'), new OptimizeCssAssetsPlugin({ cssProcessorOptions: { safe: true, }, }) ); }Programming Language: ECMAScript