Description
Hey everyone! We know progress on [email protected]
has been stagnating for a while.
We put together a lofty set of goals when we first started v2.
The scope of these changes have proven themselves to be too large to effectively polish everything and create a stable build.
To remediate this, we're going to reduce the scope of v2, polish completed features, and release v2 as stable within the next two (2) weeks.
Action Plan
Our proposed plan of action is as follows (in no particular order):
-
✅ Fix vendor chunking (Case against enabling
AutomaticCommonsChunksPlugin
in webpack by default #4977, react-scripts v2 webpack 4 splitChunks name setting should use the default #4769, An explanation of my magically shrinking build size with subsequent alpha builds #4633, Make chunking toggleable #4632)- Vendor chunking exhibits undesirable behavior when used in combination with code splitting. The application dependencies used by every application chunk end up in a single vendor bundle, effectively nullifying the value of code splitting.
- We would like to create a vendor chunk per application chunk. If this behavior cannot be achieved, we will revert vendoring and place dependencies in the application chunks.
- As an alternative to the former, we may only enable the vendor chunk when no code splitting is used in your application (if possible).
-
✅ Switch to Terser (Cannot turn off es5 compile #4948, @next runs out of memory on build, throws JS stacktracke #4902, Consider switching to terser #4711, disable reduce_vars in uglify-es due to bug in code generation #4692, CRA generating invalid sourcemaps? #4683, CRA 2 browserslist build can generate invalid code #4665, Reconsider whether it's safe to rely on recent Uglify versions #4329, Preserve Licenses #4116, String is modified in the production build #4100)
- Uglify-ES has been the source of a lot of problems, and is no longer maintained. We should switch to Terser (the more maintained fork of Uglify-ES) to fix obscure bugs resulting from production builds.
-
✅ Revert monoreport support (Add support for yarn and lerna monorepos. #3741, Use yarn when running inside yarn workspace. #3997, Add support for new yarn workspaces config format #4001) because there's too many issues (react-scripts 2.0 breaks some monorepos #4569, jest runs all tests found in monorepo [email protected] #4410, next@b2fd8db8 throws if monorepo with nwb modules #4249, RFC: Source Packages #4092, Require monorepo source workspace packages to be opted in via glob. #4570, Can't use a CRA project inside Yarn Workspaces #3031, Support running create-react-app inside a monorepo. #3967)
- We would've loved to figure out all of the ergonomics around monorepo support, but it turns out it's just too difficult.
- We're going to revert monorepo support in favor of consuming library packages via
nwb
and provide excellent documentation on how to do so. This is arguably the best way.
-
✅ Fix edge-cases for compiling
node_modules
and polish Babel 7 upgrade- Compiling
node_modules
has surfaced some issues, particularly aroundasync
/await
andregenerator
. - We also need to make sure all of our Babel configuration tricks are valid for v7.
- Compiling
-
✅ Remove
mjs
support- The ecosystem is not ready for
mjs
support and we're going to remove support to fix complex edge cases with resolving modules. There are alternative resolve orders based on source file and supported features which are concepts Jest does not have support for yet. - This will be added back in the future.
- The ecosystem is not ready for
-
✅ Drop advanced proxy configuration and replace it with
express
middleware- Allowing users to configure their proxy in package json has been a pain-point and source of configuration, going against our values of convention.
- We will remove the ability to configure the proxy and replace it with exposing the
express
app instance. You can attach any middleware or routes to thisexpress
app that you'd like. - A recipe for proxying requests will be provided in the documentation.
-
✅ Remove support for targeting newer browsers
- We added support for targeting specific sets of browsers and there has been multiple issues that cropped up about this. We are going to remove the ability to target browsers and compile everything down to ES5 -- this is in line with v1 behavior.
- The difference now is that we compile
node_modules
, so you can consume any package using newer syntax without worry. - In a follow up release, (potentially v2.1) we will explore adding a "modern"/evergreen browser mode which outputs modern, (nearly) uncompiled ESnext. This should give users the best of both worlds, and is in line with what we see in the community. A proposal going into more detail will be put together after the release of v2.
How can I help?
Please let us know your thoughts and if we missed anything.
We'll be more than happy to explain our rationale around these decisions if there's any further questions.
If there's anything you (and the community) feel strongly about but is not found on this list, please make an effort to send a PR!
We'll be more than happy to accept contributions.
Cheers, everyone!