2020-08-25 22:17:24 +03:00
|
|
|
/*!
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
|
|
|
|
module.exports = env => {
|
2020-08-26 20:36:25 +03:00
|
|
|
const htmlTemplate = "./src/index.html";
|
2020-08-27 19:42:02 +03:00
|
|
|
const plugins = env && env.clean
|
2020-08-25 22:17:24 +03:00
|
|
|
? [new CleanWebpackPlugin(), new HtmlWebpackPlugin({ template: htmlTemplate })]
|
|
|
|
: [new HtmlWebpackPlugin({ template: htmlTemplate })];
|
|
|
|
|
|
|
|
const mode = env && env.prod
|
|
|
|
? "production"
|
|
|
|
: "development";
|
|
|
|
|
|
|
|
return {
|
|
|
|
devtool: "inline-source-map",
|
|
|
|
entry: {
|
2021-09-03 01:52:47 +03:00
|
|
|
app: "./src/app.js",
|
2020-08-25 22:17:24 +03:00
|
|
|
},
|
|
|
|
mode,
|
|
|
|
output: {
|
|
|
|
filename: "[name].[contenthash].js",
|
|
|
|
},
|
|
|
|
plugins,
|
2020-12-10 02:47:21 +03:00
|
|
|
devServer: {
|
|
|
|
open: true
|
|
|
|
}
|
2020-08-25 22:17:24 +03:00
|
|
|
};
|
|
|
|
};
|