swc-project / swc

Rust-based platform for the Web
https://swc.rs
Apache License 2.0
30.95k stars 1.21k forks source link

Option to disable use of createElement in jsx automatic transform #8230

Open dsherret opened 10 months ago

dsherret commented 10 months ago

Describe the feature

Background: https://github.com/swc-project/swc/issues/8215

The use of createElement creates a bit of complication in Deno because then we need to analyze the code to tell if the createElement entrypoint is used in various cases. Since this scenario has never worked in Deno and the scenario is being deprecated everywhere, we'd like to just not transform with createElement ever.

There is this comment here, which suggests that createElement won't be used in the transform in the future: https://github.com/swc-project/swc/blob/f2c1da891b9263c560f6475b41b1d5d100144691/crates/swc_ecma_transforms_react/src/jsx/static_check.rs#L3-L7

Would you accept a PR to add an option to not transform with createElement and always use the automatic jsx transform?

Babel plugin or link to the feature description

No response

Additional context

No response

kdy1 commented 10 months ago

Yeap. Of course!

dsherret commented 10 months ago

Great! I'll start on this soon.

magic-akari commented 10 months ago

I wish the future would come sooner. 🤣 https://x.com/dan_abramov/status/1639491252583276544