From da60fe0b96b13b8af9eb906655eac656f81af183 Mon Sep 17 00:00:00 2001 From: George Fu Date: Thu, 30 May 2024 16:24:49 -0400 Subject: [PATCH] fix(core): set module exports field for bundlers (#6149) --- packages/core/package.json | 5 +++++ packages/core/scripts/lint.js | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/core/package.json b/packages/core/package.json index b3b2b8dfbb14..706f61082ae7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -20,29 +20,34 @@ "types": "./dist-types/index.d.ts", "exports": { ".": { + "module": "./dist-es/index.js", "node": "./dist-cjs/index.js", "import": "./dist-es/index.js", "require": "./dist-cjs/index.js", "types": "./dist-types/index.d.ts" }, "./package.json": { + "module": "./package.json", "node": "./package.json", "import": "./package.json", "require": "./package.json" }, "./client": { + "module": "./dist-es/submodules/client/index.js", "node": "./dist-cjs/submodules/client/index.js", "import": "./dist-es/submodules/client/index.js", "require": "./dist-cjs/submodules/client/index.js", "types": "./dist-types/submodules/client/index.d.ts" }, "./httpAuthSchemes": { + "module": "./dist-es/submodules/httpAuthSchemes/index.js", "node": "./dist-cjs/submodules/httpAuthSchemes/index.js", "import": "./dist-es/submodules/httpAuthSchemes/index.js", "require": "./dist-cjs/submodules/httpAuthSchemes/index.js", "types": "./dist-types/submodules/httpAuthSchemes/index.d.ts" }, "./protocols": { + "module": "./dist-es/submodules/protocols/index.js", "node": "./dist-cjs/submodules/protocols/index.js", "import": "./dist-es/submodules/protocols/index.js", "require": "./dist-cjs/submodules/protocols/index.js", diff --git a/packages/core/scripts/lint.js b/packages/core/scripts/lint.js index 8766fc133807..f9900a24cef4 100644 --- a/packages/core/scripts/lint.js +++ b/packages/core/scripts/lint.js @@ -20,6 +20,7 @@ for (const submodule of submodules) { if (!pkgJson.exports[`./${submodule}`]) { errors.push(`${submodule} submodule is missing exports statement in package.json`); pkgJson.exports[`./${submodule}`] = { + module: `./dist-es/submodules/${submodule}/index.js`, node: `./dist-cjs/submodules/${submodule}/index.js`, import: `./dist-es/submodules/${submodule}/index.js`, require: `./dist-cjs/submodules/${submodule}/index.js`,