forked from BetterDiscord/BetterDiscord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
73 lines (71 loc) · 1.67 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
66
67
68
69
70
71
72
73
const path = require("path");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: "development",
target: "node",
devtool: "eval-cheap-source-map",
entry: "./src/index.js",
output: {
filename: "remote.js",
path: path.resolve(__dirname, "dist")
},
externals: {
electron: `require("electron")`,
fs: `require("fs")`,
path: `require("path")`,
request: `require("request")`,
events: `require("events")`,
rimraf: `require("rimraf")`,
yauzl: `require("yauzl")`,
mkdirp: `require("mkdirp")`
},
resolve: {
extensions: [".js", ".jsx"],
modules: [
path.resolve("src", "builtins"),
path.resolve("src", "data"),
path.resolve("src", "modules")
]
},
module: {
rules: [
{
test: /.jsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
query: {
presets: [["@babel/env", {
targets: {
node: "12.8.1",
chrome: "78"
}
}], "@babel/react"]
}
},
{
test: /\.css$/i,
use: ["css-loader"],
}
]
},
plugins: [
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /a\.js|node_modules/,
// add errors to webpack instead of warnings
// failOnError: true,
// set the current working directory for displaying module paths
cwd: process.cwd(),
})
],
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {drop_debugger:false}
}
})
]
}
};