-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbabel.config.js
More file actions
55 lines (53 loc) · 1.83 KB
/
babel.config.js
File metadata and controls
55 lines (53 loc) · 1.83 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
const test = process.env.NODE_ENV === 'test'
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: test ? { node: 'current' } : { browsers: 'defaults, not IE 11' },
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: [
[
'babel-plugin-react-compiler',
{
// Support React 17 as a minimum
target: '17',
logger: {
/**
* @param {string | null} filename
* @param {import('babel-plugin-react-compiler').LoggerEvent} event
*/
logEvent(filename, event) {
if (
event.kind === 'CompileError' ||
event.kind === 'CompileSkip' ||
event.kind === 'PipelineError'
) {
if (event.kind === 'CompileError') {
console.warn(
`\n[React Compiler] \x1b[33m${event.kind}\x1b[0m: ${filename}`,
)
}
if (event.detail?.reason) {
console.error(`Reason: ${event.detail.reason}`)
}
}
},
},
},
],
'@babel/proposal-object-rest-spread',
[
'@babel/plugin-transform-runtime',
{
// Prevent helpers from being inlined in the output code
// https://babeljs.io/docs/babel-plugin-transform-runtime#version
version: '^7.28.4',
},
],
],
}