-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
62 lines (59 loc) · 1.95 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
52
53
54
55
56
57
58
59
60
61
62
const { ProvidePlugin } = require('webpack');
const path = require('path');
const webpack = require('webpack');
const { aliasWebpack, aliasJest } = require('react-app-alias')
const { alias } = require('react-app-rewire-alias');
const options = {}; // default is empty for most cases
module.exports.jest = aliasJest(options)
module.exports = aliasWebpack(options)
module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
alias({
'@assets': 'src/assets',
'@styles': 'src/assets/styles',
'@scss': 'src/assets/styles/scss',
'@chakra': 'src/assets/styles/chakra',
'@themes': 'src/assets/styles/themes',
'@images': 'src/assets/images',
'@yfd': 'src/assets/images/yfd',
'@components': 'src/components',
'@inputs': 'src/components/inputs',
'@features': 'src/features',
'@pages': 'src/pages',
'@layouts': 'src/layouts',
'@routes': 'src/routes',
'@hooks': 'src/hooks',
'@recoil': 'src/recoil',
'@utilities': 'src/utilities',
'@types': 'src/types',
'@var': 'src/utilities/variables',
'Variables': 'src/utilities/variables.ts'
})(config);
Object.assign(fallback, {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve('buffer'),
assert: require.resolve("assert"),
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify"),
url: require.resolve("url"),
});
config.resolve.fallback = fallback;
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]);
config.ignoreWarnings = [/Failed to parse source map/];
config.module.rules.push({
test: /\.(js|mjs|jsx)$/,
enforce: "pre",
loader: require.resolve("source-map-loader"),
resolve: {
fullySpecified: false,
},
});
return config;
};