-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
45 lines (41 loc) · 843 Bytes
/
Copy pathconfig-overrides.js
File metadata and controls
45 lines (41 loc) · 843 Bytes
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
const {
override,
overrideDevServer,
addWebpackPlugin
} = require("customize-cra");
const CopyPlugin = require('copy-webpack-plugin');
const RewireMultipleEntry = require('react-app-rewire-multiple-entry');
const multipleEntry = RewireMultipleEntry([
{
entry: 'src/popup/index.js',
template: 'public/popup.html',
outPath: '/popup.html'
},
{
entry: 'src/page/index.jsx',
template: 'public/index.html',
outPath: '/index.html'
}
]);
const devServerConfig = () => config => {
return {
...config,
writeToDisk: true
}
}
const copyPlugin = new CopyPlugin({
patterns: [
{ from: 'public', to: '' },
]
})
module.exports = {
webpack: override(
addWebpackPlugin(
copyPlugin
),
multipleEntry.addMultiEntry,
),
devServer: overrideDevServer(
devServerConfig()
),
};