forked from woocommerce/woocommerce-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
59 lines (56 loc) · 1.25 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
51
52
53
54
55
56
57
58
59
const {
babelConfig: e2eBabelConfig,
} = require( '@woocommerce/e2e-environment' );
module.exports = function ( api ) {
api.cache( true );
return {
...e2eBabelConfig,
presets: [
...e2eBabelConfig.presets,
'@babel/preset-typescript',
'@wordpress/babel-preset-default',
],
sourceType: 'unambiguous',
plugins: [
/**
* This allows arrow functions as class methods so that binding
* methods to `this` in the constructor isn't required.
*/
'@babel/plugin-proposal-class-properties',
],
ignore: [ 'packages/**/node_modules' ],
env: {
production: {
plugins: [
[
'@wordpress/babel-plugin-makepot',
{
output: 'languages/woocommerce-admin.po',
},
],
],
},
storybook: {
plugins: [
/**
* We need to set loose mode here because the storybook's default babel config enables the loose mode.
* The 'loose' mode configuration must be the same for those babel plugins.
*
*/
[
'@babel/plugin-proposal-class-properties',
{ loose: true },
],
[
'@babel/plugin-proposal-private-methods',
{ loose: true },
],
[
'@babel/plugin-proposal-private-property-in-object',
{ loose: true },
],
],
},
},
};
};