-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcraco.config.js
More file actions
65 lines (60 loc) · 1.63 KB
/
craco.config.js
File metadata and controls
65 lines (60 loc) · 1.63 KB
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
module.exports = {
typescript: {
enableTypeChecking: false
},
devServer: (devServerConfig) => {
// webpack-dev-server v5 compatibility patch for react-scripts 5.0.1
// Several options were renamed or restructured in v5:
// - onBeforeSetupMiddleware/onAfterSetupMiddleware -> setupMiddlewares
// - https -> server
const {
onBeforeSetupMiddleware,
onAfterSetupMiddleware,
https,
...rest
} = devServerConfig;
const config = {
...rest,
setupMiddlewares: (middlewares, devServer) => {
if (onBeforeSetupMiddleware) {
onBeforeSetupMiddleware(devServer);
}
if (onAfterSetupMiddleware) {
onAfterSetupMiddleware(devServer);
}
return middlewares;
},
};
// Convert https option to server option if present
if (https) {
config.server = {
type: 'https',
options: typeof https === 'object' ? https : {},
};
}
return config;
},
webpack: {
configure: (webpackConfig, { env }) => {
// Handle ESM/CommonJS issues for development
if (env === 'development') {
webpackConfig.module.rules.push({
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
});
// Ignore TypeScript errors for problematic modules in dev mode
webpackConfig.ignoreWarnings = [
{
module: /echarts-for-react/,
},
{
module: /react-csv/,
},
];
}
return webpackConfig;
},
},
};