Skip to content

Turborepo + Hono - Relative imports require explicit extensions with node16/nodenext #1188

@digoburigo

Description

@digoburigo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions