-
Notifications
You must be signed in to change notification settings - Fork 0
fix: switch build to CommonJS and add exports field to package.json #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,12 @@ | |
| ], | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "require": "./dist/index.js", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
|
Comment on lines
+21
to
+26
|
||
| "engines": { | ||
| "node": ">=20" | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changeset implies
moduleResolution: Node10is what makesdist/emit CommonJS. The emitted module format is controlled bycompilerOptions.module;moduleResolutiononly affects how TypeScript resolves imports/types during compilation. Consider rewording this bullet so the release note is technically accurate.