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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: do a single-pass babel transform for JSX and Hook Names #29

Merged
merged 2 commits into from Dec 23, 2021

Conversation

ElMassimo
Copy link
Collaborator

@ElMassimo ElMassimo commented Oct 28, 2021

Description 馃摉

This pull request moves the babel-plugin-transform-hook-names babel plugin to the main JSX transform, avoiding a double-pass Babel transform which is slower.

Might want to review ignoring whitespace.

Potential Caveats 鈿狅笍

Because now esbuild runs afterwards, types won't have been removed when the plugin runs.

If a user uses the following syntax the name in devtools will be memo: number instead of memo:

const memo: number = useMemo(...)

However, it's not idiomatic usage, and the most common usage works as expected:

const memo = useMemo<number>(...)

and in most cases the type would be auto-inferred from the initial value or expression.

fixes #34

@ElMassimo ElMassimo added the enhancement New feature or request label Nov 3, 2021
@ElMassimo
Copy link
Collaborator Author

@marvinhagemeister Let me know your thoughts, I think it's worth the trade-off 馃槂

@ElMassimo
Copy link
Collaborator Author

ElMassimo commented Dec 22, 2021

@JoviDeCroock Noticed that you have a branch changing the babel config for the hook names transform.

In this pull request I unified all babel transforms, so it matches the desired behavior.

@JoviDeCroock JoviDeCroock merged commit 4c307e5 into main Dec 23, 2021
@ElMassimo ElMassimo deleted the hook-names-performance branch December 23, 2021 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

babel.config.js getting loaded
2 participants