generated from reZach/secure-electron-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.production.js
35 lines (34 loc) · 1.09 KB
/
webpack.production.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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CspHtmlWebpackPlugin = require("csp-html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const merge = require("webpack-merge");
const base = require("./webpack.config");
const path = require("path");
const nonce = require("./create-nonce")();
module.exports = merge(base, {
mode: "production",
devtool: "nosources-source-map", //https://webpack.js.org/configuration/devtool/ && https://github.com/webpack/webpack/issues/5627#issuecomment-389492939
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "app/src/index-prod.ejs"),
filename: "index-prod.html",
nonce: nonce
}),
new CspHtmlWebpackPlugin(
{
"base-uri": ["'self'"],
"object-src": ["'none'"],
"script-src": ["'self'"],
"style-src": ["'self'", `'nonce-${nonce}'`],
"frame-src": ["'none'"],
"worker-src": ["'none'"]
},
{
hashEnabled: {
"style-src": false
}
}
)
]
});