-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig-overrides.js
37 lines (32 loc) · 1.29 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
const path = require('path');
const srcRoot = path.resolve(__dirname, 'src');
const uiKitRoot = path.resolve(__dirname, 'node_modules/@gravity-ui/uikit');
const uiKitIconsRoot = path.resolve(__dirname, 'node_modules/@gravity-ui/icons');
module.exports = {
webpack: (config, env) => {
const oneOfRule = config.module.rules.find((r) => r.oneOf);
oneOfRule.oneOf.splice(0, 0, {
test: /\.svg$/,
include: [
path.resolve(srcRoot, 'assets/icons'),
path.resolve(uiKitRoot, 'assets/icons'),
uiKitIconsRoot,
],
loader: '@svgr/webpack',
options: {dimensions: false},
});
if (env === 'production') {
config.output.path = path.resolve(__dirname, 'build/');
}
return config;
},
jest: (config) => {
// Some @gravity-ui libs (react-data-table, paranoid) are build in esm only
// So they need to be transformed
// By default jest does not transform anything in node_modules
// So this override excludes node_modules except @gravity-ui
// see https://github.com/timarney/react-app-rewired/issues/241
config.transformIgnorePatterns = ['node_modules/(?!(@gravity-ui)/)'];
return config;
},
};