forked from RueNetwork/RueClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
46 lines (42 loc) · 1.15 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
const isBrowser = process.env.BROWSERSLIST_ENV !== 'server';
// Use commonjs for Node
const modules = isBrowser ? false : 'commonjs';
const codeSplit = require( './server/config' ).isEnabled( 'code-splitting' );
// We implicitly use browserslist configuration in package.json for build targets.
const config = {
presets: [
[
'@babel/env',
{
modules,
useBuiltIns: 'entry',
corejs: 2,
// Exclude transforms that make all code slower, see https://github.com/facebook/create-react-app/pull/5278
exclude: [ 'transform-typeof-symbol' ],
},
],
'@automattic/calypso-build/babel/default',
],
plugins: [ [ '@automattic/transform-wpcalypso-async', { async: isBrowser && codeSplit } ] ],
env: {
build_pot: {
plugins: [
[
'@automattic/babel-plugin-i18n-calypso',
{
dir: 'build/i18n-calypso/',
headers: {
'content-type': 'text/plain; charset=UTF-8',
'x-generator': 'calypso',
},
},
],
],
},
test: {
presets: [ [ '@babel/env', { targets: { node: 'current' } } ] ],
plugins: [ 'add-module-exports', 'babel-plugin-dynamic-import-node' ],
},
},
};
module.exports = config;