Doctor 🤖
Doctor 🤖3y ago

is it possible to change how tsx bundles to js?

So I’m wondering if it’s possible to get Deno to convert
<div class="test">Potato</div>
<div class="test">Potato</div>
to
{
tag: "div",
props: { class: "test" },
children: [
"Potato"
]
}
{
tag: "div",
props: { class: "test" },
children: [
"Potato"
]
}
when bundling
3 Replies
Doctor 🤖
Doctor 🤖OP3y ago
Instead of the function it replaces it with. Yes I can have a function that essentially creates this from that, but that requires making several variables and moving them around where this would just be declaring a massive variable and possibly doing only the dynamic stuff in it.
Moomoo
Moomoo3y ago
I doubt that's possible. As far as I understand, Deno just uses TypeScript's JSX transformer, which always turns JSX into a function call. I don't think it's possible to add something like a custom Babel transformer to Deno, which is probably what it would take to do what you want.
Doctor 🤖
Doctor 🤖OP3y ago
Shame