Turborepo + Hono - Relative imports require explicit extensions with node16/nodenext
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.2k
- Forks
- 1.8k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 6
Description
Trying the template of Turborepo + Hono with the simple setup as it is I can deploy normally.
But if I extend the example to a more real world scenario, for example, introducing more folders and other packages from the monorepo like:
// hono - src/index.ts
import { ... } from "@acme/..."; // from a package in the monorepo
import { auth } from "./lib/auth"; // from a relative file for organization purposes
When trying the build I'm getting this kind of errors.
Error: ../../packages/api/src/index.ts(2,35): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './orpc.js'?
../../packages/api/src/index.ts(3,32): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './root.js'?
../../packages/api/src/index.ts(4,27): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './root.js'?
How can I configure the tsconfig.json or something to make it work?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Turborepo + Hono template, its tsconfig.json files, and the imports in src/index.ts and packages/api/src/index.ts. Reproduce the node16/nodenext build error and determine the configuration or import convention needed; done means the documented example builds with the shown relative imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100