diff --git a/package.json b/package.json index 9043425c..105c50bc 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,14 @@ "bin": "lib/cli.js", "exports": { ".": { - "types": "./lib/main.d.ts", - "import": "./lib/main.js", - "require": "./lib/cjs/main.cjs" + "import": { + "types": "./lib/main.d.ts", + "default": "./lib/main.js" + }, + "require": { + "types": "./lib/cjs/main.d.cts", + "default": "./lib/cjs/main.cjs" + } } }, "repository": "github:puppeteer/replay", @@ -37,7 +42,8 @@ "lib", "!lib/**/*.d.ts", "!lib/**/*.d.ts.map", - "lib/main.d.ts" + "lib/main.d.ts", + "lib/cjs/main.d.cts" ], "author": "Chrome DevTools authors", "license": "Apache-2.0", diff --git a/rollup.config.cjs b/rollup.config.cjs index 73c853d6..cc6f83cd 100644 --- a/rollup.config.cjs +++ b/rollup.config.cjs @@ -22,10 +22,16 @@ module.exports = [ }, { input: 'src/main.ts', - output: { - file: 'lib/main.d.ts', - format: 'es', - }, + output: [ + { + file: 'lib/main.d.ts', + format: 'es', + }, + { + file: 'lib/cjs/main.d.cts', + format: 'cjs', + }, + ], external: [ 'devtools-protocol', 'devtools-protocol/types/protocol-mapping.js',