imporved webpack config with development flag
This commit is contained in:
parent
8e185d9f98
commit
5f79a68066
@ -5,6 +5,8 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
const DEVELOPMENT = process.env.NODE_ENV === "development";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
context: path.join(__dirname, "src"),
|
context: path.join(__dirname, "src"),
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -15,7 +17,7 @@ module.exports = {
|
|||||||
path: path.join(__dirname, "dist"),
|
path: path.join(__dirname, "dist"),
|
||||||
filename: "bundle.js"
|
filename: "bundle.js"
|
||||||
},
|
},
|
||||||
devtool: "source-map",
|
devtool: DEVELOPMENT ? "source-map" : false,
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: "./dist",
|
contentBase: "./dist",
|
||||||
inline: true,
|
inline: true,
|
||||||
@ -53,7 +55,8 @@ module.exports = {
|
|||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: "index.html",
|
filename: "index.html",
|
||||||
template: "index.html",
|
template: "index.html",
|
||||||
hash: true
|
hash: true,
|
||||||
|
minify: !DEVELOPMENT
|
||||||
}),
|
}),
|
||||||
new MiniCssExtractPlugin()
|
new MiniCssExtractPlugin()
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user