-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
42 lines (35 loc) · 888 Bytes
/
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
const Path = require('path');
const dir = (...args) => Path.resolve(__dirname, ...args);
const config = (name, entry, target) => ({
mode: 'production',
devtool: 'cheap-module-source-map',
target,
entry: {
[name]: dir(entry),
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
modules: ['src', 'node_modules'],
},
module: {
rules: [
{test:/\.tsx?$/, loader:'ts-loader', exclude:/node_modules/},
{test:/\.(png|svg|html|css)$/, loader:'file-loader', exclude:/node_modules/, options:{
name: '[name].[ext]',
}},
],
},
output: {
path: dir('build'),
filename: '[name].js',
},
devServer: {
writeToDisk: true,
contentBase: dir('build'),
stats: 'errors-only',
},
});
module.exports = [
config('main', 'src/main/index.ts', 'electron-main'),
config('app', 'src/index.tsx', 'electron-renderer'),
];