mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-21 05:20:19 +08:00
* Transform async functions with regenerator Remove `transform-async-to-generator`, which to my understanding is meant to be used in environments that support generators natively. Because we're compiling generators to ES5 anyway, we can simply use `regenerator` to transform async functions too, which results in slightly simpler output and only uses the regenerator runtime instead regenerator runtime + _asyncToGenerator Babel helper. * Add babel-plugin-transform-regenerator * Use dependencies with an exact version
31 lines
991 B
JavaScript
31 lines
991 B
JavaScript
/**
|
|
* 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 = {
|
|
babelrc: false,
|
|
cacheDirectory: true,
|
|
presets: [
|
|
require.resolve('babel-preset-es2015'),
|
|
require.resolve('babel-preset-es2016'),
|
|
require.resolve('babel-preset-react')
|
|
],
|
|
plugins: [
|
|
require.resolve('babel-plugin-syntax-trailing-function-commas'),
|
|
require.resolve('babel-plugin-syntax-async-functions'),
|
|
require.resolve('babel-plugin-transform-class-properties'),
|
|
require.resolve('babel-plugin-transform-object-rest-spread'),
|
|
require.resolve('babel-plugin-transform-regenerator'),
|
|
[require.resolve('babel-plugin-transform-runtime'), {
|
|
helpers: false,
|
|
polyfill: false,
|
|
regenerator: true
|
|
}]
|
|
]
|
|
};
|