babel.prod.js 1.82 KB
Newer Older
1
// @remove-on-eject-begin
2
3
4
5
6
7
8
9
/**
 * 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.
 */
10
// @remove-on-eject-end
11

12
13
var path = require('path');

14
module.exports = {
15
  // Don't try to find .babelrc because we want to force this configuration.
Dan Abramov's avatar
Dan Abramov committed
16
  babelrc: false,
17
  presets: [
18
19
    // Latest stable ECMAScript features
    require.resolve('babel-preset-latest'),
20
    // JSX, Flow
Dan Abramov's avatar
Dan Abramov committed
21
22
    require.resolve('babel-preset-react')
  ],
23
  plugins: [
24
    // class { handleClick = () => { } }
Dan Abramov's avatar
Dan Abramov committed
25
    require.resolve('babel-plugin-transform-class-properties'),
26
    // { ...todo, completed: true }
Dan Abramov's avatar
Dan Abramov committed
27
    require.resolve('babel-plugin-transform-object-rest-spread'),
28
    // function* () { yield 42; yield 43; }
29
30
31
32
    [require.resolve('babel-plugin-transform-regenerator'), {
      // Async functions are converted to generators by babel-preset-latest
      async: false
    }],
33
    // Polyfills the runtime needed for async/await and generators
Dan Abramov's avatar
Dan Abramov committed
34
35
36
    [require.resolve('babel-plugin-transform-runtime'), {
      helpers: false,
      polyfill: false,
37
38
39
40
      regenerator: true,
      // Resolve the Babel runtime relative to the config.
      // You can safely remove this after ejecting:
      moduleName: path.dirname(require.resolve('babel-runtime/package'))
41
42
    }],
    // Optimization: hoist JSX that never changes out of render()
43
44
45
46
47
    // Disabled because of issues:
    // * https://github.com/facebookincubator/create-react-app/issues/525
    // * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/
    // TODO: Enable again when these issues are resolved.
    // require.resolve('babel-plugin-transform-react-constant-elements')
Dan Abramov's avatar
Dan Abramov committed
48
  ]
49
};