From 8f8ca5c47be4cc094f8241fefd1b468797f5fc5a Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Thu, 1 Jun 2023 14:58:15 +0200 Subject: [PATCH] refactor: exports for types and package.json To ensure that `package.json` is qccessible, it has to be exported. See https://github.com/nodejs/node/issues/33460 For the same reason, we now export TypeScript types. --- package.json | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 3dd9662..036d6b9 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,19 @@ "node": "^14.18.0 || >=16.0.0" }, "type": "module", - "main": "./dist/index.cjs", "module": "./dist/index.js", - "es2015": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./dist/index.cjs", "exports": { - "module": "./dist/index.js", - "require": "./dist/index.cjs", - "default": "./dist/index.js" + "./package.json": "./package.json", + ".": { + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + }, + "types": "./dist/index.d.ts", + "module": "./dist/index.js", + "default": "./dist/index.js" + } }, "imports": { "#dev": { @@ -42,10 +47,8 @@ }, "sideEffects": false, "files": [ - "dist/*.cjs", - "dist/*.d.ts", - "dist/*.js", "dist/**/*.cjs", + "dist/**/*.d.cts", "dist/**/*.d.ts", "dist/**/*.js" ],