-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
77 lines (70 loc) · 2.6 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// INFO about this file in https://github.com/timarney/react-app-rewired
/* eslint @typescript-eslint/no-var-requires: "off" */
const {
override,
addBabelPlugins,
addWebpackPlugin,
addWebpackResolve
} = require("customize-cra");
const webpack = require("webpack");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
// module.exports = override(addBabelPlugins("babel-plugin-styled-components"));
// // eslint-disable-next-line @typescript-eslint/no-var-requires
// const { alias, aliasJest, configPaths } = require("react-app-rewire-alias");
// const aliasMap = configPaths("./tsconfig.paths.json");
// module.exports = alias(aliasMap);
// module.exports.jest = aliasJest(aliasMap);
module.exports = {
// The Webpack config to use when compiling your react app for development or production.
webpack: override(
process.env.USE_BABEL_PLUGIN_ISTANBUL &&
addBabelPlugins("babel-plugin-istanbul"),
function override(config) {
let loaders = config.resolve;
loaders.fallback = {
util: require.resolve("util/")
};
config.ignoreWarnings = [
/Failed to parse source map/,
/Critical dependency: Accessing import\.meta directly is unsupported \(only property access is supported\)/
];
return config;
},
addWebpackResolve({
fallback: {
buffer: require.resolve("buffer"),
stream: require.resolve("stream-browserify"),
assert: require.resolve("assert/"),
fs: false,
constants: require.resolve("constants-browserify"),
path: require.resolve("path-browserify"),
crypto: require.resolve("crypto-browserify")
}
}),
addWebpackPlugin(
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"]
})
),
process.env.ANALYZE_BUNDLE &&
addWebpackPlugin(new BundleAnalyzerPlugin({ analyzerMode: "server" }))
),
// The Jest config to use when running your jest tests - note that the normal rewires do not
// work here.
jest: function (config) {
// ...add your jest config customisation...
config.moduleNameMapper = {
"\\.(css|less|scss|sass)$": "<rootDir>/test/__mocks__/styleMock.js",
"react-markdown": "<rootDir>/test/__mocks__/react-markdown.js",
"remark-gfm": "<rootDir>/test/__mocks__/remark-gfm.js",
"rehype-raw": "<rootDir>/test/__mocks__/rehype-raw.js"
};
config.transformIgnorePatterns = [
// '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
"node_modules/(?!(@rainbow-me/rainbowkit)/)",
"^.+\\.module\\.(css|sass|scss)$"
];
return config;
}
};