babel.prod.js 1.48 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

module.exports = {
11
  // Don't try to find .babelrc because we want to force this configuration.
Dan Abramov's avatar
Dan Abramov committed
12
  babelrc: false,
13
  presets: [
14
    // let, const, destructuring, classes, modules
Dan Abramov's avatar
Dan Abramov committed
15
    require.resolve('babel-preset-es2015'),
16
    // exponentiation
Dan Abramov's avatar
Dan Abramov committed
17
    require.resolve('babel-preset-es2016'),
18
    // JSX, Flow
Dan Abramov's avatar
Dan Abramov committed
19
20
    require.resolve('babel-preset-react')
  ],
21
  plugins: [
22
    // function x(a, b, c,) { }
Dan Abramov's avatar
Dan Abramov committed
23
    require.resolve('babel-plugin-syntax-trailing-function-commas'),
24
    // await fetch()
25
    require.resolve('babel-plugin-syntax-async-functions'),
26
    // class { handleClick = () => { } }
Dan Abramov's avatar
Dan Abramov committed
27
    require.resolve('babel-plugin-transform-class-properties'),
28
    // { ...todo, completed: true }
Dan Abramov's avatar
Dan Abramov committed
29
    require.resolve('babel-plugin-transform-object-rest-spread'),
30
    // function* () { yield 42; yield 43; }
31
    require.resolve('babel-plugin-transform-regenerator'),
32
    // Polyfills the runtime needed for async/await and generators
Dan Abramov's avatar
Dan Abramov committed
33
34
35
36
    [require.resolve('babel-plugin-transform-runtime'), {
      helpers: false,
      polyfill: false,
      regenerator: true
37
38
39
    }],
    // Optimization: hoist JSX that never changes out of render()
    require.resolve('babel-plugin-transform-react-constant-elements')
Dan Abramov's avatar
Dan Abramov committed
40
  ]
41
};