forked from chrismaltby/gb-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.renderer.config.js
80 lines (76 loc) · 1.98 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
68
69
70
71
72
73
74
75
76
77
78
79
80
const rules = require("./webpack.rules");
const plugins = require("./webpack.plugins");
const CopyPlugin = require("copy-webpack-plugin");
const Path = require("path");
rules.push({
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
});
const rendererPlugins = [].concat(
plugins,
new CopyPlugin({
patterns: [{ from: "node_modules/vm2", to: "node_modules/vm2" }],
})
);
const srcPath = (subdir) => {
return Path.join(__dirname, "src", subdir);
};
module.exports = {
// Put your normal webpack config below here
target: "electron-renderer",
module: {
rules,
},
optimization: {
minimize: false,
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", ".wasm", ".css"],
alias: {
"react-dom": "@hot-loader/react-dom",
store: srcPath("store"),
components: srcPath("components"),
lib: srcPath("lib"),
ui: srcPath("components/ui"),
},
},
externals: {
vm2: "vm2",
fsevents: "require('fsevents')",
},
};