From 99dda78235a2a0b8f7bf94a3eec870447f6390f3 Mon Sep 17 00:00:00 2001 From: Joeri van Oostveen Date: Mon, 6 Jul 2026 19:55:46 +0200 Subject: [PATCH 1/4] fix: correct dual-package hazard in package exports package.json declared "type": "module" but "main" still pointed to the CommonJS build (dist/maquette.cjs.js). Because the file extension was .js, Node/Vite parsed it as ESM despite its CommonJS content, causing "ReferenceError: exports is not defined" in consumers. Rename the CJS build output to dist/maquette.cjs (unambiguous CommonJS regardless of "type": "module") and add an explicit exports map so import/require resolve to the correct build. --- package.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index eed1ba5..5f3f82d 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,18 @@ "url": "https://github.com/AFASSoftware/maquette" }, "module": "./dist/index.js", - "main": "./dist/maquette.cjs.js", + "main": "./dist/maquette.cjs", "browser": "./dist/maquette.umd.js", "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "browser": "./dist/maquette.umd.js", + "import": "./dist/index.js", + "require": "./dist/maquette.cjs" + }, + "./package.json": "./package.json" + }, "scripts": { "prepare": "husky", "prepublishOnly": "npm run clean && npm run dist", From a6d1f7cf0e774a2fa565d1bd41e7a05c229e8945 Mon Sep 17 00:00:00 2001 From: Joeri van Oostveen Date: Mon, 6 Jul 2026 20:07:43 +0200 Subject: [PATCH 2/4] fix: preserve deep dist imports with exports wildcard --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f3f82d..393b6ce 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "import": "./dist/index.js", "require": "./dist/maquette.cjs" }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./dist/*": "./dist/*" }, "scripts": { "prepare": "husky", From 3c95f42e1be19d627bb2c8f5f841fda554d4f17f Mon Sep 17 00:00:00 2001 From: Joeri van Oostveen Date: Tue, 7 Jul 2026 09:56:35 +0200 Subject: [PATCH 3/4] fix: remove redundant legacy fields and unused deep exports --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 393b6ce..8ac6780 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,7 @@ "type": "git", "url": "https://github.com/AFASSoftware/maquette" }, - "module": "./dist/index.js", "main": "./dist/maquette.cjs", - "browser": "./dist/maquette.umd.js", "types": "./dist/index.d.ts", "exports": { ".": { @@ -29,8 +27,7 @@ "import": "./dist/index.js", "require": "./dist/maquette.cjs" }, - "./package.json": "./package.json", - "./dist/*": "./dist/*" + "./package.json": "./package.json" }, "scripts": { "prepare": "husky", From 715d168bc9ca2ecf5089a2072c4d4a7848d75278 Mon Sep 17 00:00:00 2001 From: Joeri van Oostveen Date: Tue, 7 Jul 2026 10:00:37 +0200 Subject: [PATCH 4/4] fix: reference exports map instead of removed pkg.browser in rollup config --- rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index c89aee7..6d5d935 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,7 +8,7 @@ export default [ input: 'dist/index.js', output: { name: 'maquette', - file: pkg.browser, + file: pkg.exports['.'].browser, format: 'umd' }, plugins: []