-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add hermes
compilation target
#16070
base: main
Are you sure you want to change the base?
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/55730/ |
Thanks! It looks like there is a TS error, you can debug it locally with |
Thanks! It is fixed. Also, the documentation PR link is updated. |
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.
I think that makes sense to add also react-native
target for Hermes bundled with React Native. core-js-compat
and compat-table
also have data for this.
I agree with adding
Is it a little weird to use
I'm not familiar with Is it correct to add |
I'm using the REPL from @babel-bot and testing via in F12/DevTools: str = `
class Foo {
#bar() {
// Should be transpiled
}
}
`;
options = {
"targets": {
"hermes": "0.7"
}
};
ret = Babel.transform(str, options);
console.log(ret.code); The output is same as input. Shouldn't it rewrite it? (sorry if stupid question, I'm new to this part of Babel) |
@kungfooman By default Babel does not apply any transform, you will have to enable the var options = {
"presets": ["env"],
"targets": {
"hermes": "0.7"
}
}; |
packages/babel-preset-env/test/fixtures/preset-options/hermes-0_7/input.mjs
Show resolved
Hide resolved
packages/babel-preset-env/test/fixtures/preset-options/hermes-0_7/options.json
Show resolved
Hide resolved
It's About a year ago I received some messages that someone wanted such target, however, I can't find those messages to invite their author to this thread. I'm also not familiar with |
I don't know about |
Change-Id: Ic1ebb3285efd5c957c145ced603b7f4248431e67 Signed-off-by: Qingyu Wang <qingyu.wang@aliyun.com>
Change-Id: I7a8501602ce6885569f521a96ececeaca0559d2f Signed-off-by: Qingyu Wang <qingyu.wang@aliyun.com>
fb8b79b
to
d783dd0
Compare
@collinaa I rebased this PR and I'm taking a look at the CI failure. According to compat-table, hermes 0.7 supports all of optional chaining except for |
@kelset I'm don't know much about the relationship between hermes and react-native either. Do you think it makes sense for us to add data for hermes independently by whether or not we have react-native compat data? |
This is basically right (in recent versions it's moved to The Versioning gets a little messy. RN builds Hermes straight from Hermes So, a |
@colinaaa Given the above points, we are currently deferring this PR to a future release. However, I'd be open to mentioning |
The same as #14944, we add
hermes
as one of the compilation targets.Now
preset-env
recognizeshermes
as a compilation target:Note that neither
browserslist
nor@mdn/browser-compat-data
has compat data ofhermes
. Sohermes
is not added tobrowserNameMap
atbabel/packages/babel-helper-compilation-targets/src/targets.ts
Lines 6 to 22 in c446ff8