forked from edrlab/thorium-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.preload.js
68 lines (59 loc) · 1.77 KB
/
webpack.config.preload.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
60
61
62
63
64
65
66
67
68
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const TerserPlugin = require("terser-webpack-plugin");
var fs = require("fs");
const path = require("path");
const webpack = require("webpack");
// Get node environment
const nodeEnv = process.env.NODE_ENV || "development";
console.log(`PRELOAD nodeEnv: ${nodeEnv}`);
let config = Object.assign(
{},
{
entry: "./node_modules/r2-navigator-js/dist/es8-es2017/src/electron/renderer/webview/preload.js",
name: "renderer webview preload",
mode: nodeEnv,
output: {
filename: "preload.js",
path: path.join(__dirname, "dist"),
// https://github.com/webpack/webpack/issues/1114
libraryTarget: "commonjs2", // commonjs-module
},
target: "electron-renderer",
externalsPresets: { node: true },
resolve: {
extensions: [".js"],
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: "disabled",
defaultSizes: "stat", // "parsed"
openAnalyzer: false,
generateStatsFile: true,
statsFilename: "stats_renderer-preload.json",
statsOptions: null,
excludeAssets: null,
}),
],
},
);
config.optimization = {
...(config.optimization || {}),
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false,
exclude: /MathJax/,
terserOptions: {
compress: false,
mangle: false,
output: {
comments: false,
},
},
}),
],
};
// {
// minimize: false,
// };
module.exports = config;