This repository has been archived by the owner on Apr 3, 2022. It is now read-only.
forked from chrismaltby/gb-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.renderer.config.js
67 lines (64 loc) · 1.66 KB
/
webpack.renderer.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
const rules = require("./webpack.rules");
const plugins = require("./webpack.plugins");
const CopyPlugin = require("copy-webpack-plugin");
rules.push({
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
});
const rendererPlugins = [].concat(
plugins,
new CopyPlugin([{ from: "node_modules/vm2", to: "node_modules/vm2" }])
);
module.exports = {
// Put your normal webpack config below here
target: "electron-renderer",
module: {
rules,
},
optimization: {
splitChunks: {
cacheGroups: {
"vendor-react": {
name: "vendor-react",
test: /[\\/]node_modules[\\/](react.*?|redux.*?)[\\/]/,
chunks: "initial",
priority: 2,
},
"vendor-scriptracker": {
name: "vendor-scriptracker",
test: /[\\/]src[\\/]lib[\\/]vendor[\\/]scriptracker[\\/]/,
chunks: "all",
priority: 2,
},
"vendor-hotloader": {
name: "vendor-hotloader",
test: /[\\/]node_modules[\\/]@hot-loader[\\/]/,
chunks: "all",
priority: 2,
},
"vendor-lodash": {
name: "vendor-lodash",
test: /[\\/]node_modules[\\/]lodash[\\/]/,
chunks: "all",
priority: 2,
},
"vendor-chokidar": {
name: "vendor-chokidar",
test: /[\\/]node_modules[\\/]chokidar[\\/]/,
chunks: "all",
priority: 2,
},
},
},
},
plugins: rendererPlugins,
resolve: {
extensions: [".js", ".ts", ".jsx", ".tsx", ".css"],
alias: {
"react-dom": "@hot-loader/react-dom",
},
},
externals: {
vm2: "vm2",
},
};