-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
57 lines (50 loc) · 1.47 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
52
53
54
55
56
57
const { override } = require('customize-cra');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const overrideEntry = (config) => {
config.entry = {
main: './src/popup', // the extension UI
background: './src/background',
content: [
'./src/content/index.js', // Include index.js
'./src/content/index.css' // Include index.css
],
};
return config;
};
const overrideOutput = (config) => {
config.output = {
...config.output,
filename: 'static/js/[name].js',
chunkFilename: 'static/js/[name].js',
};
return config;
};
const overridePlugins = (config) => {
config.plugins.push(
new MiniCssExtractPlugin({
filename: 'static/css/[name].css',
chunkFilename: 'static/css/[id].css',
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'icons', // Source directory
to: 'icons' // Destination directory
},
{
from: 'images', // Source directory
to: 'images' // Destination directory
}
]
})
);
return config;
};
module.exports = {
webpack: (config) => {
config = override(overrideEntry, overrideOutput)(config);
config = overridePlugins(config);
return config;
},
};