From 2fc64edf90c7311d448ab8b3acacdd59e950684c Mon Sep 17 00:00:00 2001 From: yasser Date: Tue, 7 Apr 2026 13:12:54 +0100 Subject: [PATCH 1/2] fix: switch build to CommonJS and add exports field to package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The package was shipping ESM output without 'type: module' and without .js extensions on internal imports — making it unloadable in Node.js. - tsconfig.build.json: module=CommonJS, moduleResolution=Node10 - package.json: added exports field with require/default conditions --- .changeset/fix-cjs-build.md | 17 +++++++++++++++++ package.json | 6 ++++++ tsconfig.build.json | 4 +++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-cjs-build.md diff --git a/.changeset/fix-cjs-build.md b/.changeset/fix-cjs-build.md new file mode 100644 index 0000000..1184a59 --- /dev/null +++ b/.changeset/fix-cjs-build.md @@ -0,0 +1,17 @@ +--- +"@ciscode/cache-kit": patch +--- + +fix: switch build output to CommonJS and add exports field to package.json + +The published package was shipping ESM-only output (`module: ESNext`) without +`"type": "module"` in package.json and without `.js` extensions on internal +imports — making the package unloadable in Node.js ESM or CJS environments. + +Changes: +- `tsconfig.build.json`: switched `module` to `CommonJS` and `moduleResolution` + to `Node10` so `dist/` emits standard CJS that Node.js loads without any + configuration on the consumer side +- `package.json`: added `exports` field with `require` and `default` conditions + pointing to `./dist/index.js`, ensuring both `require()` and `import` work + correctly when consumers use the package diff --git a/package.json b/package.json index d8b742b..da8ccd4 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,12 @@ ], "main": "./dist/index.js", "types": "./dist/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "default": "./dist/index.js" + } + }, "engines": { "node": ">=20" }, diff --git a/tsconfig.build.json b/tsconfig.build.json index 22fa5d9..a4b1152 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -3,7 +3,9 @@ "compilerOptions": { "noEmit": false, "emitDeclarationOnly": false, - "outDir": "dist" + "outDir": "dist", + "module": "CommonJS", + "moduleResolution": "Node10" }, "include": ["src/**/*.ts"], "exclude": ["test", "**/*.spec.ts", "**/*.test.ts", "dist", "node_modules"] From 1bca0fe2d8ca5a8ca609715fbdecc8ff6426eda8 Mon Sep 17 00:00:00 2001 From: yasser Date: Tue, 7 Apr 2026 13:59:26 +0100 Subject: [PATCH 2/2] chore: bump version to 0.0.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d8fe84c..a55e081 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ciscode/cachekit", - "version": "0.0.1", + "version": "0.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ciscode/cachekit", - "version": "0.0.1", + "version": "0.0.2", "license": "MIT", "devDependencies": { "@changesets/cli": "^2.27.7", diff --git a/package.json b/package.json index da8ccd4..0160193 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ciscode/cache-kit", - "version": "0.0.1", + "version": "0.0.2", "description": "CacheKit backend module for reusable caching utilities and integrations.", "author": "CisCode", "publishConfig": {