-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.config.js
More file actions
57 lines (52 loc) · 1.32 KB
/
Copy pathwebpack.prod.config.js
File metadata and controls
57 lines (52 loc) · 1.32 KB
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
const path = require('path');
const { merge } = require('webpack-merge');
const base = require('./webpack.base.config');
const prod = merge(base, {
mode: 'production',
devtool: false,
optimization: {
minimize: true,
usedExports: true,
sideEffects: false,
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
});
const mainConfig = merge(prod, {
target: 'electron-main',
node: { __dirname: false, __filename: false },
entry: { index: './src/browser/index.ts' },
output: {
path: path.join(__dirname, 'dist/browser'),
filename: '[name].js',
},
externals: {
'@wfcd/items': 'commonjs @wfcd/items',
'@napi-rs/canvas': 'commonjs @napi-rs/canvas',
},
});
const preloadConfig = merge(prod, {
target: 'electron-preload',
entry: { preload: './src/preload/preload.ts' },
output: {
path: path.join(__dirname, 'dist/preload'),
filename: '[name].js',
},
});
const rendererConfig = merge(prod, {
target: 'electron-renderer',
entry: { app: './src/renderer/index.tsx' },
output: {
path: path.join(__dirname, 'dist/renderer'),
filename: '[name].[contenthash].js',
},
});
module.exports = [mainConfig, preloadConfig, rendererConfig];