Skip to content

Commit

Permalink
Correct Babel dependency behavior (#5046)
Browse files Browse the repository at this point in the history
* Correct babel dependency compile target

* Correctly compile runtime for dependencies
  • Loading branch information
Timer authored Sep 20, 2018
1 parent 7d41493 commit a1a08db
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions packages/babel-preset-react-app/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,45 @@ module.exports = function(api, opts) {
// Latest stable ECMAScript features
require('@babel/preset-env').default,
{
// We want Create React App to be IE 9 compatible until React itself
// no longer works with IE 9
targets: {
ie: 9,
},
// Users cannot override this behavior because this Babel
// configuration is highly tuned for ES5 support
ignoreBrowserslistConfig: true,
// If users import all core-js they're probably not concerned with
// bundle size. We shouldn't rely on magic to try and shrink it.
useBuiltIns: false,
// Do not transform modules to CJS
modules: false,
},
],
].filter(Boolean),
plugins: [
// Polyfills the runtime needed for async/await, generators, and friends
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
[
require('@babel/plugin-transform-runtime').default,
{
corejs: false,
helpers: false,
regenerator: true,
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
// We should turn this on once the lowest version of Node LTS
// supports ES Modules.
useESModules: isEnvDevelopment || isEnvProduction,
},
],
// function* () { yield 42; yield 43; }
!isEnvTest && [
require('@babel/plugin-transform-regenerator').default,
{
// Async functions are converted to generators by @babel/preset-env
async: false,
},
],
].filter(Boolean),
};
};

0 comments on commit a1a08db

Please sign in to comment.