This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
webpack.config.js
65 lines (60 loc) · 1.7 KB
/
webpack.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
60
61
62
63
64
65
const path = require("path");
const webpack = require("webpack");
const plugins = require("./config/Webpack/plugins");
const rules = require("./config/Webpack/rules");
const optimizations = require("./config/Webpack/optimizations");
const PRODUCTION = process.env.NODE_ENV === "production";
const DEVELOPMENT = !PRODUCTION;
const RELEASE_MODE = !!process.env.RELEASE_MODE;
const SRC_DIR = path.resolve(__dirname, "src/react");
const BUILD_DIR = path.resolve(__dirname, "app/react");
const OUTPUT_DIR = "./";
const moduleOptions = {
BUILD_DIR,
OUTPUT_DIR,
PRODUCTION,
DEVELOPMENT,
RELEASE_MODE
};
let config = {
entry: {
bunqDesktop: `${SRC_DIR}/react-app.jsx`
},
target: "electron-renderer",
output: {
path: BUILD_DIR,
filename: OUTPUT_DIR + "[name].js",
pathinfo: PRODUCTION,
publicPath: "react/",
chunkFilename: OUTPUT_DIR + "[name].bundle.js"
},
resolve: {
extensions: [".tsx", ".ts", ".jsx", ".js", ".json"],
modules: ["node_modules", path.resolve(__dirname, "./src")]
},
mode: DEVELOPMENT ? "development" : "production",
devtool: DEVELOPMENT ? "cheap-module-eval-source-map" : "source-map",
cache: DEVELOPMENT,
performance: PRODUCTION
? {
hints: "warning"
}
: false,
plugins: plugins(moduleOptions),
optimization: optimizations(moduleOptions),
module: {
rules: rules(moduleOptions),
unsafeCache: DEVELOPMENT
},
watchOptions: {
aggregateTimeout: 300
},
node: {
console: false,
__dirname: false,
fs: "empty",
net: "empty",
tls: "empty"
}
};
module.exports = config;