From 20241c5bdffcc77025ea778257193f1afbe40768 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 22 May 2022 01:10:29 +1200 Subject: [PATCH] feat: export types for module resolution node 16 --- package.json | 7 +++++-- rollup.config.ts | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 63218976..da35e27b 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,12 @@ "sideEffects": false, "type": "module", "exports": { + "types": { + "import": "./dist/node/types/current/index.d.mts", + "require": "./dist/node/types/current/index.d.cts" + }, "import": "./dist/node/index.mjs", - "require": "./dist/node/index.cjs", - "default": "./dist/node/index.cjs" + "require": "./dist/node/index.cjs" }, "main": "dist/node/index.cjs", "module": "dist/node/index.mjs", diff --git a/rollup.config.ts b/rollup.config.ts index b7dfb292..39ad7928 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -72,10 +72,16 @@ const esm = defineConfig({ const dts = defineConfig({ ...common, - output: { - file: "dist/node/types/current/index.d.ts", - format: "es", - }, + output: [ + { + file: pkg.exports.types.import, + format: "esm", + }, + { + file: pkg.exports.types.require, + format: "cjs", + }, + ], plugins: [ rollupPluginTypescript({