Skip to content
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

feat: Script and HasIsland available at multiple runtimes by replacing renderer source #170

Conversation

usualoma
Copy link
Member

@usualoma usualoma commented May 6, 2024

I believe that runtime compatibility has been solved by the approach of rewriting the import statement ( like #161 ).
The challenge now is how to provide a compatible useRequestContext.

The approach tried in #168, using AsyncLocalStorage, is a wholly runtime-independent and clean method, but
@yusukebe's research has shown that it may cause poor DX in Cloudflare Pages, so it is better not to use it.

So what do we do now?

Although relying on the renderer implementation is not clean (compared to AsyncLocalStorage), realistically, the renderer used in honox is hono/jsx-renderer or @hono/${jsxImportSource}-renderer, so replacing this would provide multi-runtime support.

@usualoma
Copy link
Member Author

usualoma commented May 6, 2024

@yusukebe How about this approach?

@usualoma usualoma changed the title feat: Script and HasIsland available at multiple runtimes by replacing renderer source feat: Script and HasIsland available at multiple runtimes by replacing renderer source May 6, 2024
@yusukebe
Copy link
Member

yusukebe commented May 6, 2024

Thank you @usualoma !

It's interesting, interesting... But, hmm.

I think some user may create their own renderer with React or another UI library without using the specific package like @hono/ui-library. So, I think it's not good to replace hono/jsx-renderer strings.

But I don't have any good idea now. I'll be thinking about it.

As you said, when I think deeply about it, I think again we want to use AsyncLocalStorage. I'll check if I can easily use it with Cloudflare Pages again.

@usualoma usualoma closed this May 9, 2024
@usualoma usualoma deleted the feat/has-island-script-multi-runtime-replace-renderer branch May 9, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants