-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
35 lines (33 loc) · 1008 Bytes
/
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
/* eslint-disable import/no-extraneous-dependencies */
const {
override,
addBabelPlugins,
addWebpackPlugin,
} = require('customize-cra');
const { InjectManifest } = require('workbox-webpack-plugin');
const WebpackLighthousePlugin = require('webpack-lighthouse-plugin');
module.exports = function overrideConfigurations(webpack, ...args) {
webpack.plugins.pop();
const overridenConf = override(
...addBabelPlugins(
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
),
addWebpackPlugin(
new InjectManifest({
swSrc: './src/sw.js',
globDirectory: webpack.output.path,
globPatterns: ['*.{png,ico}'],
}),
),
process.env.LIGHTHOUSE_AUDIT === 'true'
? addWebpackPlugin(
new WebpackLighthousePlugin({
url: 'http://localhost:5000',
disableDeviceEmulation: true,
}),
)
: null,
)(webpack, ...args);
return overridenConf;
};