θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

The JavaScript kit returns a wrong result when using Hono's html helperΒ #238

@Angelmmiguel

Description

@Angelmmiguel

Describe the bug

I developed an application that uses the html helper from Hono. The original code is the following one (before bundling it with esbuild):

import { Hono } from 'hono'
import { html } from 'hono/html'

const app = new Hono()

app.get('/:username', (c) => {
  const { username } = c.req.param()
  return c.html(
    html`<!DOCTYPE html>
      <h1>Hello! ${username}!</h1>`
  );
})

export default app;

Wasm Workers Server returns an "error running the function" message.

Reproduction steps

  1. Create a new folder

  2. Create an index.js file with the content above

  3. Bundle it with esbuild:

    npx esbuild index.js --format=esm --bundle --outfile=dist/[...app].js
    
  4. Run the current main branch of the project and pass the dist folder as an argument:

    cargo run -- ../PATH_TO_HONO_PROJECT_FOLDER/dist
    
  5. Try to access http://localhost:8080/hi

Expected behavior

The following application returns a correct HTML code instead of an error.

Additional context

No response

Metadata

Metadata

Assignees

Labels

πŸ› bugSomething isn't workingπŸ”¨ sdksIssues related to language SDKs

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions