From 8ad4f3d81891a5a0703f85e4a2cb30c04aaf1ff7 Mon Sep 17 00:00:00 2001 From: Matt Stone Date: Tue, 25 Aug 2026 07:59:59 +1000 Subject: [PATCH] Point main at the CJS build so named imports resolve under Node The UMD bundle assigns its export inside the factory, where Node's CJS lexer cannot see it, so `import { Collapse }` resolves to undefined for anything using Node resolution. dist/react-collapse.cjs already ships and ends with a plain `exports.Collapse`, which is detectable. Restores the exports map removed in 74a7131, against the current filenames, with a ./dist/* passthrough so the deep paths the README documents keep working. --- package.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 62994a7..155209b 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,18 @@ "private": false, "version": "3.0.15", "type": "module", - "main": "dist/react-collapse.umd.js", + "main": "dist/react-collapse.cjs", "module": "dist/react-collapse.mjs", "types": "dist/react-collapse.d.ts", + "exports": { + ".": { + "types": "./dist/react-collapse.d.ts", + "import": "./dist/react-collapse.mjs", + "require": "./dist/react-collapse.cjs" + }, + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, "files": [ "dist" ],