Created by: gaearon
Proof of concept for https://github.com/facebookincubator/create-react-app/issues/1125.
This currently runs all node_modules
through babel-preset-env
.
(Which was unsafe in Babel 6, but should—maybe—be safe in Babel 7.)
I don't know the impact on the build time. It'll definitely make the cold start slower but hopefully repeated builds will be okay. We need some measurements with larger projects here: https://mobile.twitter.com/dan_abramov/status/952248179478745089.
I intentionally only did this for webpack. I don’t think we need to do this for tests because you control the Node version on which you run the tests, unlike the user’s browser. And it’s never required to compile because we intentionally don’t allow any custom transforms (like JSX). Only “real” JS gets compiled.
TODO:
-
Measure build time impact -
Consider opt-out heuristics (e.g. "too old" engines
field that implies we don't need compilation) -
Verify this doesn't break third-party code -
Verify generators and async/await work in deps -
Verify helpers for the above are being shared (e.g. runtime transform) -
Verify .babelrc
in packages gets ignored -
Create end-to-end tests for these situations