-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (38 loc) · 1.12 KB
/
index.js
File metadata and controls
46 lines (38 loc) · 1.12 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
module.exports = {
overrideWebpackConfig: ({ webpackConfig, context: { env } }) => {
if (env === "production") {
return webpackConfig;
}
let conf = webpackConfig;
if (!conf || !conf.module || !conf.module.rules) {
return webpackConfig;
}
const condition = u => typeof u === "object" && u.loader && u.loader.includes("eslint-loader");
const rule = conf.module.rules.find(rule => rule.use && rule.use.some(condition));
if (rule) {
const use = rule.use.find(condition);
if (use) {
use.options.emitWarning = true;
}
}
return conf;
},
overrideCracoConfig: ({ cracoConfig }) => {
if (!cracoConfig.webpack) {
cracoConfig.webpack = {};
}
if (!cracoConfig.webpack.alias) {
cracoConfig.webpack.alias = {};
}
cracoConfig.webpack.alias["react-dom"] = "@hot-loader/react-dom";
const babelConfig = cracoConfig.babel || {};
const babelPlugins = babelConfig.plugins || [];
return {
...cracoConfig,
babel: {
...babelConfig,
plugins: [...babelPlugins, "react-hot-loader/babel"],
},
};
}
};