Skip to content
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 targets #15612

Open
1 task done
chenyulun opened this issue May 6, 2023 · 2 comments · May be fixed by #16070
Open
1 task done

add hermes targets #15612

chenyulun opened this issue May 6, 2023 · 2 comments · May be fixed by #16070

Comments

@chenyulun
Copy link

chenyulun commented May 6, 2023

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

{
  "targets": {
    "hermes": "0.7.2"
  }
}
Error: [BABEL] /Users/useName/gitlab/react-native-pui/reactNativePui/index.ts: @babel/helper-compilation-targets: 'hermes' is not a valid target
- Did you mean 'chrome'? (While processing: "/Users/useName/gitlab/react-native-pui/reactNativePui/node_modules/@babel/preset-env/lib/index.js")
    at validateTargetNames (/Users/useName/gitlab/react-native-pui/reactNativePui/node_modules/@babel/preset-env/node_modules/@babel/helper-compilation-targets/lib/index.js:60:13)

Describe the solution you'd like

Support incoming hermes environment parameters configuration,
like
#14944

Describe alternatives you've considered

No

Documentation, Adoption, Migration Strategy

like
#14944

@babel-bot
Copy link
Collaborator

Hey @chenyulun! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 7, 2023

Hermes is in compat-table, so we can do this. We already did something similar a couple of months ago, adding support for Deno as you already saw — that PR is a good example to follow.

Since you checked "Would you like to work on this feature?", I'm leaving here some instructions :)

If it is the first time that you contribute to Babel, follow these steps: (you need to have make and yarn available on your machine)

  1. Write a comment there to let other possible contributors know that you are working on this bug.
  2. Fork the repo
  3. Run git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel
  4. Run yarn && make bootstrap
  5. Wait ⏳
  6. Add Hermes to packages/babel-compat-data. All the JSON files are generated using make build-compat-data.
  7. Run make watch (or make build whenever you change a file)
  8. Add support for Hermes in packages/babel-helper-compilation-targets
  9. Add a test in packages/babel-preset-env (only input.js; output.js will be automatically generated)
  10. yarn jest preset-env to run the tests
    • If some test outputs don't match but the new results are correct, you can delete the bad output.js files and run the tests again
    • If you prefer, you can run OVERWRITE=true yarn jest [name-of-the-package-to-test] and they will be automatically updated.
  11. If it is working, run make test to run all the tests
  12. Run git push and open a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants