Open zloirock opened 2 years ago
Thanks for the close attention in this audit. It took me awhile to recall, but we excluded many of these for a reason: https://github.com/GoogleChrome/lighthouse/pull/10937 . I hadn't heard of core-js-compat
until now, I'll have to go through the reasoning for excluding some of these and see if it still holds.
BTW, we have a test harness for verifying this stuff: yarn test-legacy-javascript
It creates various bundles using core-js@2 and 3 with different options, and snapshots the signals found. The expectation is that we find no signals when bundling withh latest core-js version + esmodules: true
. I see we are a few big updates behind ( https://github.com/GoogleChrome/lighthouse/blob/8100b8034507e679c95b2fab5ab48965875443b6/lighthouse-core/scripts/legacy-javascript/run.js#L242 ) so I'm updating that now.
Seems the only signal we giving a false-positive for at the moment is es6.object.get-own-property-names
so I am removing that. It makes me wonder why the Array prototype methods you pointed out in #13439 are not being found in the esmodules: true
variant. I'd like to understand that first before removing those signals too.
Ah, I updated babel too and I see Array.prototype.reduceRight, Array.prototype.reduce, Number.parseInt
in the false positives. OK.
Seems the only signal we giving a false-positive for at the moment is
es6.object.get-own-property-names
so I am removing that.
That's strange since in the test from the head of this thread you can find es6.object.get-own-property-names
in the output, so it should not be polyfilled with esmodules: true
.
I'll take a look at test-legacy-javascript
tomorrow.
I hadn't heard of
core-js-compat
until now, I'll have to go through the reasoning for excluding some of these and see if it still holds.
core-js-compat
is the data source that's used for automatic polyfilling in babel
and other tools, other data sets are not oriented to polyfilling ES and miss too many cases, so it's strange to orient to something else.
es6.object.get-own-property-names
Obsolete preset-env
core-js: 2
mode uses compat-table
as a data source, however even here Object.getOwnPropertyNames
should not be polyfilled with esmodules: true
target.
Continuation of #13439.
Let's check what
core-js
modules are not required in engines with ES modules support:=>
In addition to currently detected features, it's:
It should be added to this list.