prepack/babel.config.js
Dominic Gannaway e170c37aaa Upgrade Prepack to Babel 7 (#2256)
Summary:
Release notes: upgrades Prepack to use Babel 7.0.0-beta.53

This is a big PR that updates all of Prepack to Babel 7. Babylon is now `babel/parser` and pretty much all of the the previous Babel packages are now located in scoped packages. I had to make a bunch of changes around Jest/Flow/Webpack to get this all working. The build times of building Prepack itself seem considerably faster (easily twice as fast locally). I followed most of the Babel 6 -> 7 upgrade guide from the Babel site in terms of changing nodes and type definitions to match the new ones.
Pull Request resolved: https://github.com/facebook/prepack/pull/2256

Differential Revision: D8850583

Pulled By: trueadm

fbshipit-source-id: 2d2aaec25c6a1ccd1ec0c08c5e7e2a71f78ac2d8
2018-07-14 09:55:18 -07:00

51 lines
1.1 KiB
JavaScript

/**
* Copyright (c) 2017-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 = function (api) {
api.cache(true);
const plugins = [
"@babel/plugin-syntax-flow",
"@babel/plugin-syntax-jsx",
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-transform-react-jsx",
"@babel/plugin-transform-react-display-name",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
];
// Webpack bundle
if (process.env.NODE_ENV === "production") {
return {
presets: [
["@babel/env", {
"targets": {
"ie": "10",
},
forceAllTransforms: true,
}],
"@babel/preset-flow",
],
plugins,
};
}
// Default
return {
presets: [
["@babel/env", {
"targets": {
"node": "6.10",
}
}],
"@babel/preset-flow",
],
plugins,
};
};