forked from wireapp/wire-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (44 loc) · 1.09 KB
/
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
43
44
45
46
// @ts-check
/* eslint-disable valid-jsdoc */
const path = require('path');
const webpack = require('webpack');
/** @type {(env: {production?: true}) => import('webpack').Configuration} */
module.exports = (env = {}) => ({
devtool: env.production ? undefined : 'eval-cheap-source-map',
entry: path.resolve(__dirname, 'electron/renderer/src/index.jsx'),
externals: {
'fs-extra': '{}',
},
mode: !env.production ? 'development' : 'production',
module: {
rules: [
{
exclude: /node_modules/,
test: /\.[tj]sx?$/,
use: ['babel-loader'],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'electron/renderer/dist'),
},
plugins: env.production
? [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
}),
]
: undefined,
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
},
stats: 'errors-only',
target: 'electron-renderer',
});