Skip to content

Instantly share code, notes, and snippets.

@ivan-vilches
Created December 4, 2019 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-vilches/54c05ef9da2f4644d06eb124064a9f2b to your computer and use it in GitHub Desktop.
Save ivan-vilches/54c05ef9da2f4644d06eb124064a9f2b to your computer and use it in GitHub Desktop.
sourcemaps working
const cssnano = require('cssnano');
const merge = require('webpack-merge');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const common = require('./webpack.config.common.js');
module.exports = merge(common, {
mode: 'production',
optimization: {
minimize: true,
},
module: {
rules: [
{
test: /\.(sass|scss)$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
'postcss-loader',
'sass-loader',
],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: cssnano,
cssProcessorOptions: {
discardComments: { removeAll: true },
map: {
inline: false,
},
},
canPrint: true,
}),
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment