forked from wexond/browser-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.renderer.js
77 lines (68 loc) · 1.53 KB
/
webpack.config.renderer.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
/* eslint-disable */
const {
getConfig,
applyEntries,
getBaseConfig,
dev,
} = require('./webpack.config.base');
const { join } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const webpack = require('webpack');
/* eslint-enable */
const PORT = 4444;
const appConfig = getConfig(getBaseConfig('app'), {
target: 'web',
devServer: {
contentBase: join(__dirname, 'build'),
port: PORT,
hot: true,
inline: true,
disableHostCheck: true,
},
plugins: dev
? [
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin(),
]
: [],
});
const extPopupConfig = getConfig({
target: 'web',
entry: {},
output: {},
});
applyEntries(appConfig, [
...(process.env.ENABLE_AUTOFILL ? ['form-fill', 'credentials'] : []),
'app',
'permissions',
'auth',
'find',
'menu',
'search',
'preview',
'tabgroup',
'downloads-dialog',
'add-bookmark',
'zoom',
'settings',
'history',
'newtab',
'bookmarks',
]);
if (process.env.ENABLE_EXTENSIONS) {
extPopupConfig.entry['extension-popup'] = [
`./src/renderer/views/extension-popup`,
];
extPopupConfig.plugins.push(
new HtmlWebpackPlugin({
title: 'Orion',
template: 'static/pages/extension-popup.html',
filename: `extension-popup.html`,
chunks: [`vendor.app`, 'extension-popup'],
}),
);
module.exports = [appConfig, extPopupConfig];
} else {
module.exports = appConfig;
}