Created by: JoviDeCroock
-
provide dynamic babel config -
provide dynamic webpack config -
Add to react-dev-utils -
opt-in with --modern
-
optimize babel config (lose some polyfills) -
test file size differences -
write documentation about --modern
For now this is a WIP since I did not know if we wanted to opt-in by default or opt-out by default.
So when running the production yarn build
at this point it will build your files with .modern
and normal. This will be served when opening in chrome you will see the .modern
in your network tab and when opening on IE11 you'll see the normal ones.
Also I have personally been advocating heavily for .modern
bundles in libraries, this would impact file size differences even more, since now every library is shipped as ES2015 by default (I don't think this is feasible for now).
big thanks to @prichodko in this PR which has heavily influenced the webpack plugin.
Own POC with polyfills for legacy and none for modern
I would like to spark some discussion about the unfinished points before I continue if this is possible.
Related: https://github.com/facebook/create-react-app/projects/5#card-15632785
EDIT: I would like to know what babel-preset-react-app/dependencies, from what I understand you transpile your deps down a bit more than usual. So in modern config we would just not include this?
If anyone has doubts about this feature, I recently made a big post about browser support etc here
NOTE: this needs a new publish of react-dev-utils