Skip to content

Fix(package.json) add types to exports and remove redundant entry point fields#244

Merged
jodeleit-es merged 2 commits intoe-Spirit:issue/242from
CaarLo1337:fix(package.json)--add-types-to-exports-and-remove-redundant-entry-point-fields
Mar 12, 2026
Merged

Fix(package.json) add types to exports and remove redundant entry point fields#244
jodeleit-es merged 2 commits intoe-Spirit:issue/242from
CaarLo1337:fix(package.json)--add-types-to-exports-and-remove-redundant-entry-point-fields

Conversation

@CaarLo1337
Copy link
Contributor

fix for #242

The types export was previously missing in package.json, which caused TypeScript types to no longer be exported starting from version 11.1.0.

Additionally, the exports field had been introduced but the existing types, main, and module fields were still present. When exports is defined, these fields are effectively ignored unless they are explicitly specified within exports.

This PR removes the redundant types, main, and module fields and adds the missing types entry to the exports configuration.

Copy link
Collaborator

@jodeleit-es jodeleit-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes for package-lock.json and proxy/package-lock.json are missing.

"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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have these lines been removed?

"keywords": [],
"main": "dist/fsxa-api.cjs.js",
"module": "dist/fsxa-api.es5.js",
"types": "dist/types",
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@nico-mcalley nico-mcalley changed the base branch from master to issue/242 March 12, 2026 14:15
@jodeleit-es
Copy link
Collaborator

Thx for the clarification.

@jodeleit-es jodeleit-es merged commit c3cb570 into e-Spirit:issue/242 Mar 12, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants