-
Notifications
You must be signed in to change notification settings - Fork 14
Fix(package.json) add types to exports and remove redundant entry point fields #244
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
Merged
jodeleit-es
merged 2 commits into
e-Spirit:issue/242
from
CaarLo1337:fix(package.json)--add-types-to-exports-and-remove-redundant-entry-point-fields
Mar 12, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,6 @@ | |
| "name": "fsxa-proxy-api", | ||
| "version": "11.1.0", | ||
| "description": "This package represents the proxy version of the JavaScript Content API Library, running on the client side.", | ||
| "main": "dist/fsxa-proxy-api.cjs.js", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have these lines been removed? |
||
| "module": "dist/fsxa-proxy-api.es5.js", | ||
| "types": "dist/types", | ||
| "author": "Justin Wiegmann <justin.wiegmann@crownpeak.com>", | ||
| "contributors": [ | ||
| "Nicolai McAlley <nicolai.mcalley@crownpeak.com>" | ||
|
|
@@ -15,6 +12,7 @@ | |
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/types/index.d.ts", | ||
| "import": "./dist/fsxa-proxy-api.es5.js", | ||
| "require": "./dist/fsxa-proxy-api.cjs.js" | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Same here: Any reason for the removal?
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.
These fields were removed because the package already defines an exports map, which takes precedence over the legacy entry fields.
According to the Node.js documentation, when "exports" is present it becomes the primary entry point definition and overrides "main":
“If both exports and main are defined, the exports field takes precedence over main.”
https://nodejs.org/api/packages.html#package-entry-points
Modern tooling (including TypeScript ≥4.7) also resolves modules via the exports field and will look for type definitions there if an export map exists. In the previous configuration the exports map did not expose any type definitions, which meant TypeScript could not resolve the package types even though "types" existed at the top level.
TypeScript documentation:
https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports
By moving the type definition into the export map
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/fsxa-api.es5.js",
"require": "./dist/fsxa-api.cjs.js"
}
}
the types are properly discoverable again when importing the package.
Since exports already defines the public entry points for both runtime and types, the legacy main, module, and types fields become redundant and can be safely removed.