Inferno JSX transformer plugin for SWC #7912
Replies: 5 comments 10 replies
-
|
Beta Was this translation helpful? Give feedback.
-
How can I create static JsWords? There are some long lists ( about 200 new words) for HTML element mapping, it sounds expensive if it needs to create them over and over again? |
Beta Was this translation helpful? Give feedback.
-
Thank you for all the help @kdy1 I got the plugin working! 🚀 The source codes are located here: One more question, how can the plugin get access to source maps as ref: https://github.com/infernojs/swc-plugin-inferno/blob/main/src/lib.rs#L79 |
Beta Was this translation helpful? Give feedback.
-
Hey, I found strange issue, when I try to emit error from the plugin it panics the program and the expected error message is not shown anywhere.
The error originates from here: https://github.com/infernojs/swc-plugin-inferno/blob/main/src/jsx/mod.rs#L555-L563 where I try to emit error message to the user. Weird thing is that this works fine when running the tests through <Comp children={bar} /> produces:
I tried looking into swc_plugins repo but I couldn't find what I could be doing differently here. I tested it with minimal plugin like this and same result. #[plugin_transform]
fn inferno_jsx_plugin(
program: Program,
_data: TransformPluginProgramMetadata,
) -> Program {
HANDLER.with(|handler| {
handler
.struct_span_err(
DUMMY_SP,
"JSX Namespace is disabled"
)
.emit()
});
return program
} |
Beta Was this translation helpful? Give feedback.
-
Everything is working great now! I'm closing this discussion. Thanks for all the help. |
Beta Was this translation helpful? Give feedback.
-
Hi!
I started building Inferno JSX transformer plugin for SWC.
https://github.com/swc-project/swc/compare/main...Havunen:swc:inferno-transformer?expand=1
I have few questions how I should proceed.
I needed to add bunch of
js_words
to make the program compile. Should these words to be extended to main SWC program or can the plugin extend those somehow? What is the recommended way of doing this?To make inferno JSX transformer work correctly I would like to replace the React JSX plugin in with Inferno JSX plugin in the configs. Can this be done from the plugin land?
Beta Was this translation helpful? Give feedback.
All reactions