-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig-overrides.js
49 lines (41 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
const isEqual = require('lodash/isEqual')
const webpack = require('webpack')
const DeadCodePlugin = require('webpack-deadcode-plugin')
module.exports = function override(config, env) {
config.plugins.push(
new webpack.ProvidePlugin({
process: 'process/browser',
}),
)
config.plugins.push(
new DeadCodePlugin({
exclude: [
'node_modules/**/*',
'dist/**/*',
'README.md',
'codegen.ts',
'config-overrides.js',
'jest.config.js',
'nginx.conf',
'package-lock.json',
'public/robots.txt',
],
}),
)
const updatedRules = config.module.rules.filter(
(rule) => !isEqual(rule, { parser: { requireEnsure: false } }),
)
config.module.rules = updatedRules
if (process.env.REACT_APP_PUBLIC_URL) {
config.output.publicPath = `${process.env.REACT_APP_PUBLIC_URL}/`
}
// Drop `ModuleScopePlugin`.
config.resolve.plugins = []
config.resolve.fallback = {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
path: require.resolve('path-browserify'),
os: false,
}
return config
}