From 44e34e3df9c9c869bd65644001a8a9e31185d238 Mon Sep 17 00:00:00 2001 From: Mischa Spiegelmock Date: Sun, 27 Mar 2022 17:10:51 +0100 Subject: [PATCH 1/2] Use require/import export map in package.json --- package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 76c4e3abc14..68854a34d5d 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,12 @@ }, "exports": { ".": { - "node": "./dist/cjs/index.js", - "es2015": "./dist/esm/index.js", - "default": "./dist/esm/index.js" + "require": "./dist/cjs/index.js", + "import": "./dist/esm/index.js" }, "./locale/*": { - "node": "./dist/cjs/locale/*.js", - "es2015": "./dist/esm/locale/*.js", - "default": "./dist/esm/locale/*.js" + "require": "./dist/cjs/locale/*.js", + "import": "./dist/esm/locale/*.js" }, "./package.json": "./package.json" }, From 393926d928c4274cdc682d26a6987c02d2ea356e Mon Sep 17 00:00:00 2001 From: Mischa Spiegelmock Date: Sun, 27 Mar 2022 18:16:08 +0100 Subject: [PATCH 2/2] fix: use .mjs extension for ESM --- package.json | 6 +++--- scripts/bundle.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 68854a34d5d..70abe33dfda 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "module": "dist/esm/index.mjs", "types": "index.d.ts", "typesVersions": { ">=4.0": { @@ -34,11 +34,11 @@ "exports": { ".": { "require": "./dist/cjs/index.js", - "import": "./dist/esm/index.js" + "import": "./dist/esm/index.mjs" }, "./locale/*": { "require": "./dist/cjs/locale/*.js", - "import": "./dist/esm/locale/*.js" + "import": "./dist/esm/locale/*.mjs" }, "./package.json": "./package.json" }, diff --git a/scripts/bundle.ts b/scripts/bundle.ts index 6d1b7b749ba..29c94102fcc 100644 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -53,4 +53,5 @@ buildSync({ splitting: true, format: 'esm', target: 'node12.20', + outExtension: { '.js': '.mjs' }, });