-
Notifications
You must be signed in to change notification settings - Fork 7
/
config-overrides.js
51 lines (47 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
/**
* Copyright (c) Quid, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @noflow
const path = require('path');
const {
override,
useEslintRc,
babelInclude,
addWebpackAlias,
} = require('customize-cra');
const lernaAlias = require('lerna-alias');
const removeModuleScopePlugin = () => config => {
config.resolve.plugins = config.resolve.plugins.filter(
p => p.constructor.name !== 'ModuleScopePlugin'
);
return config;
};
/**
* react-app-rewired configuration file
*
* Theses functions are used to override the configurations provided by
* create-react-app to be able to tweak it without ejecting the
* project. Be careful!
*/
module.exports = {
webpack: override(
babelInclude([path.resolve('src'), path.resolve('packages')]),
useEslintRc(),
removeModuleScopePlugin(),
addWebpackAlias(lernaAlias.webpack())
),
jest: config => {
// create-react-app looks for tests in `src`, we look in `packages`
config.roots = ['<rootDir>/packages'];
config.testMatch = config.testMatch.map(m => m.replace('src', 'packages'));
config.collectCoverageFrom = ['**/packages/**/*.js'];
config.coveragePathIgnorePatterns = ['/dist/'];
// we tell Jest to import the @quid packages from their source directory
// rather than from the dist one, so we don't have to build them each time
config.moduleNameMapper = lernaAlias.jest();
return config;
},
};