-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
index.js
36 lines (35 loc) · 856 Bytes
/
index.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
module.exports = function( api ) {
const isTestEnv = api.env() === 'test';
return {
presets: [
! isTestEnv && [ '@babel/preset-env', {
modules: false,
targets: {
browsers: [ 'extends @wordpress/browserslist-config' ],
},
} ],
isTestEnv && [ '@babel/preset-env', {
useBuiltIns: 'usage',
} ],
].filter( Boolean ),
plugins: [
'@babel/plugin-proposal-object-rest-spread',
[
'@wordpress/babel-plugin-import-jsx-pragma',
{
scopeVariable: 'createElement',
source: '@wordpress/element',
isDefault: false,
},
],
[ '@babel/plugin-transform-react-jsx', {
pragma: 'createElement',
} ],
'@babel/plugin-proposal-async-generator-functions',
! isTestEnv && [ '@babel/plugin-transform-runtime', {
helpers: true,
useESModules: false,
} ],
].filter( Boolean ),
};
};