-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
31 lines (30 loc) · 1.05 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
const { execSync } = require('child_process')
const webpack = require('webpack')
const _ = require('lodash')
const path = require('path')
const rewireReactHotLoader = require('react-app-rewire-hot-loader')
const rewireEslint = require('react-app-rewire-eslint')
const manualOverrides = require('./webpack.config')
/* config-overrides.js */
module.exports = {
webpack: function override(config, env) {
config = rewireEslint(config, env)
config.resolve.modules = manualOverrides.resolve.modules
config.module.rules[2].oneOf.unshift(
{
include: [path.resolve(__dirname, 'src/icons')],
loader: 'raw-loader'
}
)
config.plugins.push(new webpack.DefinePlugin({
SATURN_VERSION: JSON.stringify(execSync('git rev-parse HEAD').toString().trim()),
SATURN_BUILD_TIMESTAMP: JSON.stringify(Date.now())
}))
return rewireReactHotLoader(config, env)
},
jest: function(config) {
return _.merge(config, {
moduleDirectories: ['node_modules', ''] // to allow Jest to resolve absolute module paths
})
}
}