-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack-main.config.js
94 lines (91 loc) · 2.57 KB
/
webpack-main.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* Copyright 2024 gematik GmbH
*
* The Authenticator App is licensed under the European Union Public Licence (EUPL); every use of the Authenticator App
* Sourcecode must be in compliance with the EUPL.
*
* You will find more details about the EUPL here: https://joinup.ec.europa.eu/collection/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the EUPL is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the EUPL for the specific
* language governing permissions and limitations under the License.ee the Licence for the specific language governing
* permissions and limitations under the Licence.
*/
const webpack = require('webpack');
const { resolve } = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const IS_DEV = process.env.NODE_ENV === 'development';
module.exports = {
mode: IS_DEV ? 'development' : 'production',
target: 'electron-main',
entry: {
main: resolve(__dirname, 'src/main/main.ts'),
preload: resolve(__dirname, 'src/main/preload.ts'),
},
watchOptions: {
ignored: '**/node_modules',
},
node: {
global: true,
__dirname: false,
__filename: false,
},
output: {
path: resolve(__dirname, 'dist_electron'),
filename: '[name].js',
clean: false,
},
devtool: 'cheap-module-source-map',
resolve: {
modules: [resolve(process.cwd(), 'src'), 'node_modules'],
extensions: ['.ts', '.js'],
symlinks: false,
cacheWithContext: false,
alias: {
'@': resolve(__dirname, 'src'),
},
},
externals: {
keytar: 'commonjs keytar',
'electron-edge-js': 'commonjs2 electron-edge-js',
},
module: {
rules: [
{
test: /\.ts?$/,
loader: 'esbuild-loader',
options: {
loader: 'ts',
target: 'ES2020',
},
},
{
test: /\.node$/,
use: 'node-loader',
},
{
test: /\.[ts|vue]/,
loader: 'webpack-preprocessor-loader',
options: {
debug: process.env.MOCK_MODE === 'ENABLED',
directives: {
// if you add "// #!no_prod" to the above of the line, it will be removed in the production build
no_prod: false,
},
params: {
MOCK_MODE: process.env.MOCK_MODE,
},
verbose: false,
},
},
],
},
plugins: [
new webpack.DefinePlugin({
window: false,
}),
new CopyPlugin({
patterns: [{ from: 'winCertStoreLib/WinCertStoreLib.dll', to: '' }],
}),
],
};