babel.prod.js 1.33 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
15
    // Latest stable ECMAScript features
    require.resolve('babel-preset-latest'),
16
    // JSX, Flow
Dan Abramov's avatar
Dan Abramov committed
17
18
    require.resolve('babel-preset-react')
  ],
19
  plugins: [
20
    // class { handleClick = () => { } }
Dan Abramov's avatar
Dan Abramov committed
21
    require.resolve('babel-plugin-transform-class-properties'),
22
    // { ...todo, completed: true }
Dan Abramov's avatar
Dan Abramov committed
23
    require.resolve('babel-plugin-transform-object-rest-spread'),
24
    // function* () { yield 42; yield 43; }
25
26
27
28
    [require.resolve('babel-plugin-transform-regenerator'), {
      // Async functions are converted to generators by babel-preset-latest
      async: false
    }],
29
    // Polyfills the runtime needed for async/await and generators
Dan Abramov's avatar
Dan Abramov committed
30
31
32
33
    [require.resolve('babel-plugin-transform-runtime'), {
      helpers: false,
      polyfill: false,
      regenerator: true
34
35
36
    }],
    // Optimization: hoist JSX that never changes out of render()
    require.resolve('babel-plugin-transform-react-constant-elements')
Dan Abramov's avatar
Dan Abramov committed
37
  ]
38
};