Skip to content

docs: use correct relative imports in code examples#850

Open
SAY-5 wants to merge 1 commit intohonojs:mainfrom
SAY-5:fix/correct-import-extensions-in-docs
Open

docs: use correct relative imports in code examples#850
SAY-5 wants to merge 1 commit intohonojs:mainfrom
SAY-5:fix/correct-import-extensions-in-docs

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 15, 2026

Per #579, docs/ code examples use relative imports without file extensions and import types without the type keyword, which fails on a fresh Hono app whose default tsconfig.json uses NodeNext module resolution and verbatimModuleSyntax.

Two classes of fixes:

  1. Extensionless relative imports get .js added (./foo./foo.js). Without this, NodeNext throws:

    Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.
    
  2. Value-position AppType imports in docs/concepts/stacks.md are converted to import type. Without this, verbatimModuleSyntax throws:

    'AppType' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
    

The two '../functions/api/[[route]]' imports are intentionally left as-is — those are Cloudflare Pages route patterns, not real file paths.

Closes #579

Per honojs#579, docs/ examples used relative imports without file extensions
and imported types without the `type` keyword, which fails on a fresh
Hono app that uses NodeNext module resolution and verbatimModuleSyntax.

Add the `.js` extension to all extensionless relative imports
(`./foo` → `./foo.js`) and convert two value-position `AppType`
imports in docs/concepts/stacks.md to `import type`.

Closes honojs#579
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.

Use correct imports in the documentation examples

1 participant