babel.dev.js 1.51 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
14
  // This is a feature of `babel-loader` for webpack (not Babel itself).
  // It enables caching results in OS temporary directory for faster rebuilds.
15
  cacheDirectory: true,
16
  presets: [
17
    // let, const, destructuring, classes, modules
Dan Abramov's avatar
Dan Abramov committed
18
    require.resolve('babel-preset-es2015'),
19
    // exponentiation
Dan Abramov's avatar
Dan Abramov committed
20
    require.resolve('babel-preset-es2016'),
21
    // JSX, Flow
Dan Abramov's avatar
Dan Abramov committed
22
23
    require.resolve('babel-preset-react')
  ],
24
  plugins: [
25
    // function x(a, b, c,) { }
Dan Abramov's avatar
Dan Abramov committed
26
    require.resolve('babel-plugin-syntax-trailing-function-commas'),
27
    // await fetch()
28
    require.resolve('babel-plugin-syntax-async-functions'),
29
    // class { handleClick = () => { } }
Dan Abramov's avatar
Dan Abramov committed
30
    require.resolve('babel-plugin-transform-class-properties'),
31
    // { ...todo, completed: true }
Dan Abramov's avatar
Dan Abramov committed
32
    require.resolve('babel-plugin-transform-object-rest-spread'),
33
    // function* () { yield 42; yield 43; }
34
    require.resolve('babel-plugin-transform-regenerator'),
35
    // Polyfills the runtime needed for async/await and generators
Dan Abramov's avatar
Dan Abramov committed
36
37
38
39
40
    [require.resolve('babel-plugin-transform-runtime'), {
      helpers: false,
      polyfill: false,
      regenerator: true
    }]
Dan Abramov's avatar
Dan Abramov committed
41
  ]
42
};