2020-08-25 22:17:24 +03:00
|
|
|
/*!
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License.
|
|
|
|
*/
|
|
|
|
|
2024-10-25 21:33:36 +03:00
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
2020-08-25 22:17:24 +03:00
|
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
|
2022-10-18 02:55:41 +03:00
|
|
|
module.exports = (env) => {
|
2023-09-11 23:33:34 +03:00
|
|
|
const htmlTemplate = "./src/index.html";
|
2024-10-25 21:33:36 +03:00
|
|
|
const plugins = [
|
|
|
|
new HtmlWebpackPlugin({ template: htmlTemplate }),
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
// Copy assets from `public`
|
|
|
|
{ from: ".", to: ".", context: "public" },
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
];
|
2020-08-25 22:17:24 +03:00
|
|
|
|
2023-09-11 23:33:34 +03:00
|
|
|
const mode = env && env.prod ? "production" : "development";
|
2020-08-25 22:17:24 +03:00
|
|
|
|
2023-09-11 23:33:34 +03:00
|
|
|
return {
|
|
|
|
devtool: "inline-source-map",
|
|
|
|
entry: {
|
|
|
|
app: "./src/app.js",
|
|
|
|
},
|
|
|
|
mode,
|
|
|
|
output: {
|
|
|
|
filename: "[name].[contenthash].js",
|
2024-01-08 20:29:47 +03:00
|
|
|
clean: true,
|
2023-09-11 23:33:34 +03:00
|
|
|
},
|
|
|
|
plugins,
|
|
|
|
devServer: {
|
|
|
|
open: false,
|
|
|
|
},
|
|
|
|
};
|
2020-08-25 22:17:24 +03:00
|
|
|
};
|