babel.dev.js 1.58 KB
Newer Older
1
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
11
var path = require('path');

12
module.exports = {
13
  // Don't try to find .babelrc because we want to force this configuration.
Dan Abramov's avatar
Dan Abramov committed
14
  babelrc: false,
15
16
  // This is a feature of `babel-loader` for webpack (not Babel itself).
  // It enables caching results in OS temporary directory for faster rebuilds.
17
  cacheDirectory: true,
18
  presets: [
19
20
    // Latest stable ECMAScript features
    require.resolve('babel-preset-latest'),
21
    // JSX, Flow
Dan Abramov's avatar
Dan Abramov committed
22
23
    require.resolve('babel-preset-react')
  ],
24
  plugins: [
25
    // class { handleClick = () => { } }
Dan Abramov's avatar
Dan Abramov committed
26
    require.resolve('babel-plugin-transform-class-properties'),
27
    // { ...todo, completed: true }
Dan Abramov's avatar
Dan Abramov committed
28
    require.resolve('babel-plugin-transform-object-rest-spread'),
29
    // function* () { yield 42; yield 43; }
30
31
32
33
    [require.resolve('babel-plugin-transform-regenerator'), {
      // Async functions are converted to generators by babel-preset-latest
      async: false
    }],
34
    // Polyfills the runtime needed for async/await and generators
Dan Abramov's avatar
Dan Abramov committed
35
36
37
    [require.resolve('babel-plugin-transform-runtime'), {
      helpers: false,
      polyfill: false,
38
39
40
41
      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'))
Dan Abramov's avatar
Dan Abramov committed
42
    }]
Dan Abramov's avatar
Dan Abramov committed
43
  ]
44
};