-
-
Notifications
You must be signed in to change notification settings - Fork 145
/
webpackprod.config.js
59 lines (58 loc) · 1.65 KB
/
webpackprod.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//const webpack = require("webpack");
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const { CAPTCHASITE } = require("./config.json");
function uuidv4() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
const config = {
entry: "./src/index.js",
plugins: [
new CopyPlugin({
patterns: [
{ from: "src/promo.html", to: "" },
{
from: "src/index.html",
to: "",
transform(content) {
return content
.toString()
.replace("INSERT_RECAPTCHA_SITE_KEY", CAPTCHASITE)
.replace("RANDOM_UUID", uuidv4());
},
},
{ from: "src/title.html", to: "" },
{ from: "src/about.html", to: "" },
{ from: "src/footer.html", to: "" },
{ from: "src/controls.html", to: "" },
{ from: "src/signup.html", to: "" },
{ from: "src/login.html", to: "" },
{ from: "src/dropdown.html", to: "" },
{ from: "src/sw.js", to: "" },
{ from: "src/manifest.json", to: "" },
{ from: "src/settings.html", to: "" },
{ from: "src/featured.html", to: "" },
{ from: "src/stylesnew1.css", to: "./" },
],
}),
],
resolve: {
extensions: [".js"],
},
module: {
rules: [
{ test: /\.(js)$/, exclude: /node_modules/, loader: "babel-loader" },
],
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "main.js",
},
devtool: "source-map",
mode: "production",
};
module.exports = config;