forked from FLMNH-MGCL/spesql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.renderer.additions.js
52 lines (43 loc) · 1.11 KB
/
webpack.renderer.additions.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
const webpack = require('webpack');
module.exports = (config) => {
config.module.rules.find((rule) => {
if (rule && rule.test && rule.test.test('.css')) {
rule.use = [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
},
},
'postcss-loader',
];
}
if (
rule &&
rule.test &&
(rule.test.test('.png') || rule.test.test('.gif'))
) {
rule.use = ['file-loader'];
}
});
// Remove browser aliases so that we always get node.js versions of modules:
config.resolve.aliasFields = [];
config.externals = ['react', 'react-dom', 'react-hook-form'];
config.plugins = [
...config.plugins,
new webpack.DefinePlugin({
PUBLIC_URL: JSON.stringify('http://localhost:5000'),
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
}),
];
if (process.env.NODE_ENV === 'development') {
config.devServer.proxy = {
'/': 'http://localhost:5000',
};
config.devServer.port = process.env.ELECTRON_WEBPACK_APP_FRONTEND_PORT;
}
return config;
};