forked from Automattic/wp-calypso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
38 lines (34 loc) · 1.04 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
const config = require( './client/server/config' );
const isBrowser = process.env.BROWSERSLIST_ENV !== 'server';
// Use commonjs for Node
const modules = isBrowser ? false : 'commonjs';
const codeSplit = config.isEnabled( 'code-splitting' );
// We implicitly use browserslist configuration in package.json for build targets.
const babelConfig = {
presets: [ [ '@automattic/calypso-build/babel/default', { modules } ] ],
plugins: [ [ '@automattic/transform-wpcalypso-async', { async: isBrowser && codeSplit } ] ],
env: {
production: {
plugins: [ 'babel-plugin-transform-react-remove-prop-types' ],
},
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 = babelConfig;