/Knowledge/sources/honojs__hono/llms-full/cloudflare-pages-client-side--d0b53a298982.md
Cloudflare Pages: Client-side - hono-docs
Cloudflare Pages: Client side Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt client side Summary You...
Cloudflare Pages: Client-side
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#client-side
Summary
You can write client-side scripts and import them into your application using Vite's features. If /src/client.ts is the entry point for the client, simply write it in the script tag. Additionally, import.meta.env.PROD is useful for d...
Content
You can write client-side scripts and import them into your application using Vite's features.
If /src/client.ts is the entry point for the client, simply write it in the script tag.
Additionally, import.meta.env.PROD is useful for detecting whether it's running on a dev server or in the build phase.
app.get('/', (c) => {
return c.html(
<html>
<head>
{import.meta.env.PROD ? (
<script type='module' src='/static/client.js'></script>
) : (
<script type='module' src='/src/client.ts'></script>
)}
</head>
<body>
<h1>Hello</h1>
</body>
</html>
)
})
In order to build the script properly, you can use the example config file vite.config.ts as shown below.
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#client-side",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Cloudflare Pages > Client-side (1)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 477,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Cloudflare Pages: Client-side",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}