Remove polyfills for not supported browsers
Description
- Configured Babel to polyfill only the UMD build. Supported browsers according to our documentation
- Remove non-standard
TerserPluginconfiguration (no longer needed since we don't use thegpujsanymore) - Configured Webpack to exclude all dependencies in
hyperformula.min.jsbuild - Removed
regenerator-runtimefromdependencies. Movedcore-jstodevDependencies. - Mentioned supported Node.js versions in the Supported browsers guide
- Instruct users to include all the required dependencies when using non-full UMD build
Browserslist configuration:
"maintained node versions",
"last 2 chrome versions",
"last 2 and_chr versions",
"last 2 firefox versions",
"last 2 and_ff versions",
"last 2 safari versions",
"last 2 ios_saf versions",
"last 2 edge versions",
"last 2 and_uc versions",
"last 2 and_qq versions",
"last 2 op_mob versions"
Build sizes [kb]:
| File/dir | develop | feature/issue-1011 |
|---|---|---|
| dist/hyperformula.min.js | 1728 | 516 |
| dist/hyperformula.full.min.js | 2048 | 812 |
| es/ | 2443 | 1494 |
| commonjs/ | 2515 | 1596 |
How has this been tested?
Test all builds:
- ES Module
- [x] in a browser, through a bundler - verified in react-demo and vanillajs-demo (parcel)
- [x] in Node
- [x] ~~directly in a browser~~ (seems to be neither possible nor supported)
- CommonJS
- [x] in a browser, through a bundler - verified in react-demo and vanillajs-demo (parcel)
- [x] in Node
- UMD (dist)
- [x] directly in a browser - verified in locally-run vanillajs-demo and
hyperformula.full.min.jsfile hosted using temporary jsdelivr link (https://cdn.jsdelivr.net/gh/handsontable/hyperformula@feature/issue-1011-jsdelivr-experiment/dist/hyperformula.full.min.js)
- [x] directly in a browser - verified in locally-run vanillajs-demo and
Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] New feature or improvement (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Additional language file or change to the existing one (translations)
- [ ] Change to the documentation
Related issues:
Fixes #1011 https://github.com/handsontable/hyperformula/issues/1006 https://github.com/handsontable/hyperformula/issues/896
Checklist:
- [x] My code follows the code style of this project.
- [x] I described the modification in the CHANGELOG.md file.
- [ ] My change requires a change to the documentation.
- [ ] My change requires a migration guide.
@warpech I analyzed the Babel's output generated for this set of browsers:
"maintained node versions",
"last 2 chrome versions",
"last 2 and_chr versions",
"last 2 firefox versions",
"last 2 and_ff versions",
"last 2 safari versions",
"last 2 ios_saf versions",
"last 2 edge versions",
"last 2 and_uc versions",
"last 2 and_qq versions",
"last 2 op_mob versions"
It seems that we have polyfills for some of the ES2015 features but not all of them. I'm guessing that some of the browsers listed above have only partial support for ES2015.
I spotted the polyfills for:
-
destructuring arrays as function parameters

-
default parameters

-
rest operator in function parameters

There are also vast blocks of code (>2k lines) generated that also seem to contain some polyfills, but it's not easy to deduce what exactly they polyfill.
The comparison of the UMDs with and without polyfills: https://github.com/handsontable/hyperformula/compare/bf899a361d35f18c1632df4604ee0e727694b5ac...feature/issue-1011-compare-polyfills?diff=split
If we want to reduce the number of polyfills, we can drop support for some of the browsers. I can figure out which browsers from the list generate the most of the polyfills.
@warpech Please assign a dev from HOT team to review this PR
Performance comparison of head (caa1c5299ba8077004711da8362c232cb2fbdc43) vs base (2805b59951cde624ec02df4e78359e797e592867)
testName | base | head | change
-----------------------------------------------------------------------
Sheet A | 463.9 | 467.9 | +0.86%
Sheet B | 200.1 | 202.8 | +1.35%
Sheet T | 254.3 | 255.2 | +0.35%
Column ranges | 551.9 | 553.6 | +0.31%
Sheet A: change value, add/remove row/column | 36 | 35 | -2.78%
Sheet B: change value, add/remove row/column | 279 | 284 | +1.79%
Column ranges - add column | 247 | 184 | -25.51%
Column ranges - without batch | 640 | 625 | -2.34%
Column ranges - batch | 150 | 128 | -14.67%
Codecov Report
Merging #1030 (caa1c52) into develop (2805b59) will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## develop #1030 +/- ##
========================================
Coverage 95.74% 95.74%
========================================
Files 161 161
Lines 14098 14098
Branches 2977 2977
========================================
Hits 13498 13498
Misses 584 584
Partials 16 16