H
Hono6mo ago
gavriguy

Using honox client.ts to load web components

I'm using honox client.ts to load web components I created in Lit. It works great but only when I have at least one island on the route. How can I make sure the js is loaded even when I don't have island on the route. I'm using <Script src='/app/client.ts' async /> in my _renderer.tsx file`
6 Replies
Memtooth
Memtooth6mo ago
Check the honox docs, react renderer part, it describes the manual <script> tags to use (lowercase S)
gavriguy
gavriguyOP6mo ago
thanks I'll give it a try
Memtooth
Memtooth6mo ago
Oh, before the react part, you can just use the lowercase script tags
Memtooth
Memtooth6mo ago
No description
Memtooth
Memtooth6mo ago
Take out has islands and there you go
gavriguy
gavriguyOP6mo ago
As I have a hashed version of the script file, I ended up copying https://github.com/honojs/honox/blob/main/src/server/components/script.tsx#L33 and removing the <HasIslands> check from the code. Thank you. it might be a good idea to allow to enable disable the <HasIslands> from the Script component props. I can make a PR if it makes sense
GitHub
honox/src/server/components/script.tsx at main · honojs/honox
HonoX - Hono based meta framework. Contribute to honojs/honox development by creating an account on GitHub.

Did you find this page helpful?