-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig-overrides.js
45 lines (39 loc) · 1.21 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
const StylelintPlugin = require('stylelint-webpack-plugin')
const getConfigFile = (filename, env) =>
filename.replace('{{ENV}}', env === 'development' ? '.dev' : '')
const getCustomEsLint = (existingConfig, env) => {
const newEsLintOptions = Object.assign({}, existingConfig, {
eslintPath: require.resolve('eslint'),
configFile: getConfigFile('.eslintrc{{ENV}}.js', env),
baseConfig: undefined,
ignore: undefined,
useEslintrc: undefined
})
return newEsLintOptions
}
module.exports = {
webpack: function (config, env) {
config.plugins.push(
new StylelintPlugin({
configFile: getConfigFile('.stylelintrc{{ENV}}.js', env)
})
)
// Customize ESLint
// Currently this is the first rule in the config
// If CRA changes the order, this will have to be updated
config.module.rules[0].use[0].options = getCustomEsLint(
config.module.rules[0].use[0].options, env
)
return config
},
jest: function (config) {
const customConfig = require('./jest.config')
return customConfig
}
// devServer: function(configFunction) {
// return function(proxy, host) {
// // customize devServer config here
// return config;
// }
// }
}