UNPKG

1.23 kBJavaScriptView Raw
1/* eslint global-require: 0 */
2
3const defaultTargetOptions = {};
4if (process.env.BABEL_TARGET === 'node') {
5 defaultTargetOptions.node = 'current';
6} else {
7 defaultTargetOptions.browsers = require('./supporting-browsers');
8}
9
10const defaultOptions = {
11 targets: defaultTargetOptions,
12 loose: true
13};
14
15function buildPresets(context, options) {
16 return {
17 presets: [
18 [
19 'env',
20 Object.assign({}, defaultOptions, options)
21 ],
22 'react'
23 ],
24 plugins: [
25 'syntax-dynamic-import',
26 'transform-proto-to-assign',
27 'transform-decorators-legacy',
28 'transform-class-properties',
29 'transform-export-extensions',
30 ['transform-object-rest-spread', { useBuiltIns: true }],
31 ['transform-runtime', { polyfill: false, helpers: false }]
32 ],
33 env: {
34 production: {
35 plugins: [
36 'transform-react-remove-prop-types',
37 'transform-react-constant-elements',
38 'transform-react-inline-elements'
39 ]
40 }
41 }
42 };
43}
44
45
46module.exports = buildPresets;