Created
December 4, 2019 00:28
-
-
Save ivan-vilches/54c05ef9da2f4644d06eb124064a9f2b to your computer and use it in GitHub Desktop.
sourcemaps working
This file contains 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 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