You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Component not being rendered with Vite + preact-ts template #298
Nothing gets rendered on the page, and there's no errors. However, if I don't use the @controller decorator, or if I remove the preact plugin, it does work. I looked at the transpiled code and noticed this:
The static get name is a way to ensure your class has the right name. It's not ideal but it can work around some transpiler issues. Let me know if the above code works for you. If it does it's likely an issue with the transpiler changing the name.
I'm not super familiar with Vite so unfortunately I can't tell you if there's some configuration option to enable to get it to not change the class name. But at least if we can pin it down to that we might be able to figure out what to do next.
Activity
keithamus commentedon Dec 24, 2022
Looks like the transpile step might be causing issues with the class name. You can add the following to see if it is a problem:
The
static get nameis a way to ensure your class has the right name. It's not ideal but it can work around some transpiler issues. Let me know if the above code works for you. If it does it's likely an issue with the transpiler changing the name.I'm not super familiar with Vite so unfortunately I can't tell you if there's some configuration option to enable to get it to not change the class name. But at least if we can pin it down to that we might be able to figure out what to do next.
miyuushi commentedon Dec 25, 2022
Yeah, that definitely solves my issue. Certainly not ideal having to add that everywhere, but at least that's the problem.
keithamus commentedon Dec 25, 2022
What does your Vite configuration look like?
miyuushi commentedon Dec 25, 2022
miyuushi commentedon Dec 25, 2022
I've tried messing with the babel plugins, hasn't really helped yet.
keithamus commentedon Dec 25, 2022
You could try removing Babel. esbuild should be able to transform any stage 4 features, as well as decorators and jsx, so Babel shouldn't be needed.
miyuushi commentedon Dec 25, 2022
Not sure how, to be honest. The preact plugin doesn't really have an option for it.