Skip to content

How to import pino with NodeNext module type #2152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Martin-Narvar opened this issue Apr 3, 2025 · 1 comment
Open

How to import pino with NodeNext module type #2152

Martin-Narvar opened this issue Apr 3, 2025 · 1 comment

Comments

@Martin-Narvar
Copy link

This problem was raised here: #543 but never resolved, and is still a problem.

When you configure a TypeScript project to use NodeNext modules, then you get a compiler error saying that pino is not a function. I tried many suggestions for different ways to write the import statement, and also using require instead, but so far nothing works.

The simplest reproduction is this source file

import { default as pino } from 'pino'

export default pino()

My tsconfig.json is

{
  "compilerOptions": {
    "rootDir": "./",
    "outDir": "./dist",
    "lib": ["es2020"],
    "target": "es2020",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "types": ["node"],
    "baseUrl": "src",
  }
}
@cluah
Copy link

cluah commented May 10, 2025

#2120

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

No branches or pull requests

2 participants