New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweak helper compilation targets #12615
Tweak helper compilation targets #12615
Conversation
When `hasTargets` is `false`, `targets` is always an empty object by definition, `objectToBrowserslist({})` always return `[]` therefore we can remove `objectToBrowserslist`.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/37377/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7f8994f:
|
@@ -4,5 +4,6 @@ | |||
"targets": { "node": 12 }, | |||
"shippedProposals": true | |||
}] | |||
] | |||
], | |||
"plugins": [["external-helpers", { "helperVersion": "7.100" }]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OT: We should really have something like "helperVersion": "__TEST__CURRENT__"
, and then the test runner replaces __TEST__CURRENT__
with the current version.
- This will work across majors
- There is no risk of actually reaching the fake version we are using here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also introduce externalHelpers
option for fixture runner that automatically plug in external-helpers
with latest helperVersion
. So we can place { externalHelpers: true }
to the root of fixtures folders in most packages which do not care whether the helper is externalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea
adf23e0
to
7f8994f
Compare
@@ -33,7 +33,6 @@ import "core-js/modules/es.array.map.js"; | |||
import "core-js/modules/es.array.of.js"; | |||
import "core-js/modules/es.array.reduce.js"; | |||
import "core-js/modules/es.array.reduce-right.js"; | |||
import "core-js/modules/es.array.reverse.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, after specifying ie 6
as targets, es.array.reverse
is removed!
Just checked it is expected, array.reverse
is supported since ie 5.5, but marked unsupported until Safari 12.0.2 (probably some bug related): https://unpkg.com/core-js-compat@3.8.2/data.json
This PR is extracted from #10897 but only includes small clean-up of
@babel/helper-compilation-targets
. It also addsbrowsers: "ie 6"
to those test fixtures which does not specify a valid target, so the tests can be more focused and will not be impacted when we later align the preset-env defaults to browserlists defaults.