This repository was archived by the owner on Jun 9, 2025. It is now read-only.
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Invalid type definitions - static import of ESM types from CJS types #447
Open
Description
Describe the bug
../../node_modules/.pnpm/@[email protected]/node_modules/@netlify/functions/dist/function/v2.d.ts:1:30 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@netlify/serverless-functions-api")' call instead.
1 export type { Context } from '@netlify/serverless-functions-api';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in ../../node_modules/.pnpm/@[email protected]/node_modules/@netlify/functions/dist/function/v2.d.ts:1
Configuration
Import the library in a project which has the following in the tsconfig.json
:
"module": "node16",
"moduleResolution": "node16",
This issue can be worked around with "skipLibCheck": true
, so ensure that is not set when reproducing. It is not set by default.