-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcraco.config.js
30 lines (29 loc) · 1.07 KB
/
craco.config.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
const CracoAlias = require('craco-alias');
// Source: https://github.com/facebook/react/issues/15315#issuecomment-638504372
module.exports = {
jest: {
configure: {
setupFilesAfterEnv: ['./src/setup-tests.ts'],
},
},
plugins: [
{
plugin: CracoAlias,
options: {
source: 'options',
baseUrl: './',
aliases: {
// We need to alias react to the one installed in the desktop/node_modules
// in order to solve the error "hooks can only be called inside the body of a function component"
// which is encountered during desktop jest unit tests,
// described at https://github.com/facebook/react/issues/13991
// This is caused by two different instances of react being loaded:
// * the first at packages/desktop/node_modules (for HostSignUpDownloadComponent.spec.js)
// * the second at packages/components/node_modules (for packages/components/Modal)
react: './node_modules/react',
'react-dom': './node_modules/react-dom',
},
},
},
],
};