From 1623fd8e0778733be482939324a60637ed74b85a Mon Sep 17 00:00:00 2001 From: Adam Coster <28758057+adam-coster@users.noreply.github.com> Date: Mon, 30 May 2022 16:17:03 -0500 Subject: [PATCH] Fix NodeNext incompatibility in package.json The spec for the "exports" field has it completely take over when present. Latest Typescript (4.7+), when using `moduleResolution` "NodeNext" follows the spec. It therefore looks for types in `package.json/exports/./types`. Puppeteer does not have that value, so Typescript gets confused and throws errors of various sorts on import statements. Adding `package.json/exports/./types = "./lib/types.d.ts"` resolves this. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 41d8fc852e1a0..b9de0f9b961fc 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "main": "./cjs-entry.js", "exports": { ".": { + "types": "./lib/types.d.ts", "import": "./lib/esm/puppeteer/node.js", "require": "./cjs-entry.js" },