-
Notifications
You must be signed in to change notification settings - Fork 5
/
config-overrides.js
51 lines (46 loc) · 1.13 KB
/
config-overrides.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
const {
override,
overrideDevServer,
addWebpackPlugin
} = require("customize-cra");
const CopyPlugin = require('copy-webpack-plugin');
const multipleEntry = require('react-app-rewire-multiple-entry')([
{
// points to the popup entry point
entry: 'src/popup/index.js',
template: 'public/popup.html',
outPath: '/popup.html'
},
{
// points to the options page entry point
entry: 'src/visualizer/index.js',
template: 'public/index.html',
outPath: '/index.html'
}
]);
const devServerConfig = () => config => {
return {
...config,
// webpackDevService doesn't write the files to desk
// so we need to tell it to do so so we can load the
// extension with chrome
writeToDisk: true
}
}
const copyPlugin = new CopyPlugin({
patterns: [
// copy assets
{ from: 'public', to: '' },
]
})
module.exports = {
webpack: override(
addWebpackPlugin(
copyPlugin
),
multipleEntry.addMultiEntry,
),
devServer: overrideDevServer(
devServerConfig()
),
};