forked from mytonwalletorg/mytonwallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-electron.config.ts
51 lines (40 loc) · 1001 Bytes
/
webpack-electron.config.ts
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
import path from 'path';
import { EnvironmentPlugin } from 'webpack';
import { PRODUCTION_URL } from './src/config';
// GitHub workflow uses an empty string as the default value if it's not in repository variables, so we cannot define a default value here
process.env.BASE_URL = process.env.BASE_URL || PRODUCTION_URL;
const { APP_ENV = 'production', BASE_URL } = process.env;
export default {
mode: 'production',
target: 'node',
entry: {
electron: './src/electron/main.ts',
preload: './src/electron/preload.ts',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.js'],
},
plugins: [
new EnvironmentPlugin({
APP_ENV,
BASE_URL,
IS_PREVIEW: false,
}),
],
module: {
rules: [
{
test: /\.(ts|tsx|js)$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
externals: {
electron: 'require("electron")',
},
};