-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcraco.config.js
More file actions
49 lines (47 loc) · 1.5 KB
/
craco.config.js
File metadata and controls
49 lines (47 loc) · 1.5 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
const path = require("path");
module.exports = {
webpack: {
configure: (webpackConfig) => {
const oneOfRule = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf));
if (oneOfRule) {
oneOfRule.oneOf.forEach(rule => {
if (
rule.loader &&
rule.loader.includes("babel-loader") &&
rule.exclude
) {
const originalExclude = rule.exclude;
rule.exclude = (input) => {
if (
typeof input === "string" &&
input.replace(/\\/g, "/").includes("node_modules/@visual-framework/vf-chatbot")
) {
return false;
}
if (typeof originalExclude === "function") {
return originalExclude(input);
}
if (Array.isArray(originalExclude)) {
return originalExclude.some(ex => input.includes(ex));
}
return false;
};
// Add this: force automatic runtime for our package
if (!rule.options) rule.options = {};
if (!rule.options.overrides) rule.options.overrides = [];
rule.options.overrides.push({
test: /@visual-framework[\\\/]vf-chatbot/,
presets: [
[
"@babel/preset-react",
{ runtime: "automatic" }
]
]
});
}
});
}
return webpackConfig;
}
}
};