forked from ariakit/ariakit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
50 lines (47 loc) · 1.18 KB
/
babel.config.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
const test = process.env.NODE_ENV === "test";
const prod = process.env.NODE_ENV === "production";
const { warn } = console;
// Prevents resolution warnings from babel-plugin-module-resolver
// See https://github.com/tleunen/babel-plugin-module-resolver/issues/315
// eslint-disable-next-line no-console
console.warn = (...args) => {
for (const arg of args) {
if (arg.startsWith("Could not resolve") && /src/.test(arg)) {
return;
}
}
warn(...args);
};
module.exports = {
presets: [
[
"@babel/preset-env",
{
modules: test ? "commonjs" : false,
loose: true,
targets: test
? { node: "current" }
: {
browsers: "defaults",
},
},
],
"@babel/preset-typescript",
"@babel/preset-react",
],
plugins: [
"reakit-warning/babel-plugin",
"babel-plugin-macros",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
!prod && [
"babel-plugin-module-resolver",
{
alias: {
"^reakit([^/]*)(.*)$": "reakit\\1/src\\2",
},
},
],
].filter(Boolean),
};