-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (58 loc) · 1.48 KB
/
webpack.config.js
File metadata and controls
60 lines (58 loc) · 1.48 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
58
59
60
const path = require('node:path');
const baseConfig = {
mode: 'development',
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'@main': path.resolve(__dirname, 'src/main'),
'@renderer': path.resolve(__dirname, 'src/renderer'),
'@shared': path.resolve(__dirname, 'src/shared'),
},
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
externals: {
electron: 'commonjs electron',
react: 'commonjs react',
'react-dom': 'commonjs react-dom',
'react-router-dom': 'commonjs react-router-dom',
'@getflywheel/local': 'commonjs @getflywheel/local',
'@getflywheel/local/renderer': 'commonjs @getflywheel/local/renderer',
'@getflywheel/local/main': 'commonjs @getflywheel/local/main',
'@getflywheel/local-components': 'commonjs @getflywheel/local-components',
},
};
module.exports = [
{
...baseConfig,
target: 'electron-main',
entry: './src/main/index.ts',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2',
},
},
{
...baseConfig,
target: 'electron-renderer',
entry: './src/renderer/index.tsx',
output: {
filename: 'renderer.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2',
},
},
];