From 684a77f814ae218d527484d09135e38f64e3a99b Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Mon, 30 Dec 2019 14:01:56 +0100 Subject: [PATCH] Remove console.log from production build --- webpack.prod.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webpack.prod.js b/webpack.prod.js index f6d3a08..3dd0b9e 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -1,9 +1,24 @@ const merge = require('webpack-merge'); const common = require('./webpack.common.js'); +const TerserPlugin = require('terser-webpack-plugin'); module.exports = merge(common, { mode: 'production', devtool: 'source-map', + optimization: { + minimizer: [ + new TerserPlugin({ + cache: true, + parallel: true, + sourceMap: true, + terserOptions: { + compress: { + pure_funcs: [ 'console.log' ] + } + } + }) + ] + }, module: { rules: [ {