From 7e52522bf6aed1f7a2deec3ee17e4a7c120a5d16 Mon Sep 17 00:00:00 2001 From: Brian Schlenker Date: Wed, 27 Mar 2024 10:51:24 -0400 Subject: [PATCH 1/4] add exports field to package.json --- package.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package.json b/package.json index 65755cc2..44c6c34f 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,21 @@ "main": "dist/a11y-dialog.js", "module": "dist/a11y-dialog.esm.js", "types": "dist/a11y-dialog.d.ts", + "exports": { + ".": { + "import": "./dist/a11y-dialog.esm.js", + "require": "./dist/a11y-dialog.js", + "types": "./dist/a11y-dialog.d.ts" + }, + "dist/*.esm.js": "./dist/*.esm.js", + "dist/*.js": "./dist/*.js", + "dist/*": { + "import": "./dist/*.esm.js", + "require": "./dist/*.js", + "types": "./dist/*.d.ts" + }, + "package.json": "./package.json" + }, "keywords": [ "modal", "dialog", From a104ab245667a7d154d187549105125aea9eab2b Mon Sep 17 00:00:00 2001 From: Kitty Giraudel <1889710+KittyGiraudel@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:29:38 +0200 Subject: [PATCH 2/4] Output CommonJS files as .cjs with Rollup --- rollup.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 3bd37b73..55812bd0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -27,16 +27,16 @@ export default [ output: [ { ...umdCfg, - file: 'dist/a11y-dialog.js', + file: 'dist/a11y-dialog.cjs', }, { ...umdCfg, - file: 'dist/a11y-dialog.min.js', + file: 'dist/a11y-dialog.min.cjs', plugins: [minify], }, { ...umdCfg, - file: 'cypress/fixtures/a11y-dialog.js', + file: 'cypress/fixtures/a11y-dialog.cjs', }, ], }, From 4f71fbab608b73e661bd8e274d8c482f243c6f8b Mon Sep 17 00:00:00 2001 From: Kitty Giraudel <1889710+KittyGiraudel@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:30:21 +0200 Subject: [PATCH 3/4] Use .cjs files in Cypress fixtures --- .gitignore | 1 + cypress/fixtures/alert-dialog.html | 2 +- cypress/fixtures/base.html | 2 +- cypress/fixtures/focus.html | 2 +- cypress/fixtures/instance.html | 2 +- cypress/fixtures/nested-dialogs.html | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f181099a..50edcc64 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ cypress/screenshots out dist/ cypress/fixtures/*.js +cypress/fixtures/*.cjs !cypress/fixtures/shadow-dom-fixture.js diff --git a/cypress/fixtures/alert-dialog.html b/cypress/fixtures/alert-dialog.html index f976da86..49a3924e 100644 --- a/cypress/fixtures/alert-dialog.html +++ b/cypress/fixtures/alert-dialog.html @@ -29,7 +29,7 @@

Dialog title

- + diff --git a/cypress/fixtures/base.html b/cypress/fixtures/base.html index 6701f532..496444cc 100644 --- a/cypress/fixtures/base.html +++ b/cypress/fixtures/base.html @@ -41,7 +41,7 @@

Dialog title

- + + + diff --git a/cypress/fixtures/nested-dialogs.html b/cypress/fixtures/nested-dialogs.html index 964b58b4..e9730308 100644 --- a/cypress/fixtures/nested-dialogs.html +++ b/cypress/fixtures/nested-dialogs.html @@ -42,7 +42,7 @@

Dialog 3

- + From 644f9b88a5175ba2edb7cac02badcec8cedf1fd2 Mon Sep 17 00:00:00 2001 From: Kitty Giraudel <1889710+KittyGiraudel@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:30:37 +0200 Subject: [PATCH 4/4] Update the exports configuration in package.json --- package.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 44c6c34f..c3c63232 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,15 @@ "module": "dist/a11y-dialog.esm.js", "types": "dist/a11y-dialog.d.ts", "exports": { - ".": { - "import": "./dist/a11y-dialog.esm.js", - "require": "./dist/a11y-dialog.js", - "types": "./dist/a11y-dialog.d.ts" - }, + "import": "./dist/a11y-dialog.esm.js", + "require": "./dist/a11y-dialog.cjs", + "types": "./dist/a11y-dialog.d.ts", "dist/*.esm.js": "./dist/*.esm.js", - "dist/*.js": "./dist/*.js", + "dist/*.cjs": "./dist/*.cjs", + "dist/*.js": "./dist/*.cjs", "dist/*": { "import": "./dist/*.esm.js", - "require": "./dist/*.js", + "require": "./dist/*.cjs", "types": "./dist/*.d.ts" }, "package.json": "./package.json"