From 5f79a680667be70eab2f003105912a7d1a043f5e Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 22 Apr 2020 16:24:58 +0200 Subject: [PATCH] imporved webpack config with development flag --- webpack.config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 170f241..d217f9b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,8 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const path = require("path"); +const DEVELOPMENT = process.env.NODE_ENV === "development"; + module.exports = { context: path.join(__dirname, "src"), resolve: { @@ -15,7 +17,7 @@ module.exports = { path: path.join(__dirname, "dist"), filename: "bundle.js" }, - devtool: "source-map", + devtool: DEVELOPMENT ? "source-map" : false, devServer: { contentBase: "./dist", inline: true, @@ -53,7 +55,8 @@ module.exports = { new HtmlWebpackPlugin({ filename: "index.html", template: "index.html", - hash: true + hash: true, + minify: !DEVELOPMENT }), new MiniCssExtractPlugin() ]