-
Notifications
You must be signed in to change notification settings - Fork 31
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JSX/TSX #110
Comments
Hi. JSX/TSX support is underway for jiti (the runtime library that powers listhen's ts support). You can follow up from here: unjs/jiti#138 |
Thanks you! |
From unjs/jiti#138, I try other solutions and render functions work well. All files are import { defineProps, h } from 'vue'
import head from './head'
import header from './header'
import type { Podcast } from '~/models/Podcast'
interface Props {
podcast: Podcast
css?: string
}
export default {
props: defineProps<Props>(),
setup(props: Props) {
return h('html', [
head.setup({ title: props.podcast.title, css: props.css }),
h('body', [
header.setup({ podcast: props.podcast }),
]),
])
},
} Of course I can render it to HTML with Thanks again! |
Nice finding! Let's keep it open. I think we can improve example and docs! |
Environment
Reproduction
I create a stackblitz project https://stackblitz.com/github/kiwilan/feedrender
But to have better reproduction, just clone repository
git clone https://github.com/kiwilan/feedrender.git cd feed-renderer pnpm i pnpm dev
Describe the bug
When we use
pnpm dev
shortcut forlisthen -w ./src/index.ts
, the output will beERROR Cannot find module './podcast-renderer' listhen 1:44:09 PM Require stack: - ./feed-render/src/react/index.ts - ./src/react/index.ts at ./src/react/index.ts:1:309 at ./src/models/Podcast.ts:2:14
The error comes from
src/react/index.ts
with an importThe file is
src/react/podcast-renderer.tsx
, a simple React file.Alternative
If I use
tsx
with......everything works.
So I think
listhen
could have a problem with React import with-w
flag?Build
When I build app with
tsup
I have no error and React component is correctly imported.
Additional context
Error import could have another origin but I try many solutions and
listhen
could be cause.Logs
No response
The text was updated successfully, but these errors were encountered: