Add build-time ES5 validation to fallback build.#36596
Conversation
ES6+ code sometimes finds its way into the fallback build, which should only include ES5, when one of our dependencies decides to ship their code with newer syntax. This PR adds a new build-time check that ensures no non-ES5 syntax is present in the generated fallback build, breaking the build if that's the case. This will help us catch these issues as soon as they happen, rather than when an IE11 user reports them. This PR also fixes all existing instances of this problem.
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~66 bytes removed 📉 [gzipped]) DetailsReact components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
blowery
left a comment
There was a problem hiding this comment.
Beautiful! This will save so much time and frustration.
|
Thank you for the review and kind words, @blowery! 😄 |
|
I wonder if this could be useful in Gutenberg as well? |
@simison I would expect this to be useful in any project that both:
|
|
@Automattic/jetpack-crew You might like to grab this linter for compiled bundles in Jetpack. It should help prevent ie11 breakage. |
|
Created an issue to track this here: Automattic/jetpack#13693 |
Add ES5 validation to production builds. Inspired by Automattic/wp-calypso#36596. Can't currently add it to the `extension` build, since there are non-ES5 constructs in them.
ES6+ code sometimes finds its way into the fallback build, which should only include ES5, when one of our dependencies decides to ship their package with newer syntax.
This PR adds a new build-time check that ensures no non-ES5 syntax is present in the generated fallback build, breaking the build if that's the case. This will help us catch these issues as soon as they happen, rather than when an IE11 user reports them.
This PR also fixes all existing instances of this problem.
Thanks to @simison for suggesting the command line check! 👍
Changes proposed in this Pull Request
validate-fallback-es5npmscript tofallbackbuild processnodeModulesToTranspileTesting instructions
Ensure the build doesn't fail. For extra points, ensure that devdocs works correctly in IE11 now (or at least it doesn't complain about invalid syntax).