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