-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
38 lines (33 loc) · 1.07 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
/* eslint-disable */
const {
override,
addWebpackAlias,
addDecoratorsLegacy,
} = require('customize-cra');
const path = require('path');
const overrideProcessEnv = (value) => (config) => {
const { plugins } = config;
const plugin = plugins.find((p) => p.constructor.name === 'DefinePlugin');
const processEnv = plugin.definitions['process.env'] || {};
plugin.definitions['process.env'] = {
...processEnv,
...value,
};
return config;
};
module.exports = override(
addDecoratorsLegacy(),
addWebpackAlias({
'@components': path.resolve(__dirname, './src/components'),
'@router': path.resolve(__dirname, './src/router'),
'@pages': path.resolve(__dirname, './src/pages'),
'@store': path.resolve(__dirname, './src/store'),
'@utils': path.resolve(__dirname, './src/utils'),
'@guards': path.resolve(__dirname, './src/guards'),
'@enums': path.resolve(__dirname, './src/enums'),
'@layout': path.resolve(__dirname, './src/layout'),
}),
overrideProcessEnv({
API_URL: JSON.stringify(process.env.API_URL || '__API_URL'),
}),
);