fix: correctly declare types in package.json exports #2972
Merged
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.
Add the
types
value to theexports
field of thepackage.json
file.This makes projects work when
moduleResolution
is set tobundler
intsconfig.json
.The previous configuration generated a TypeScript compiler error:
A reproduction test project has been added to validate the change.
Notes
Issue detected in process-analytics/bpmn-visualization-examples#390 (comment)
Reproduced with a minimal setup in process-analytics/bpmn-visualization-examples#580.
TypeScript documentation: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#packagejson-exports-imports-and-self-referencing
The
exports
field in thepackage.json
file was introduced in #2840.Implementation validation
Remove the
types
property of theexports
field in thepackage.json
file. This restores a configuration equivalent to that which existed before the change.Then run the test in
test/typescript-moduleResolution-bundler
. It will fail whereas it succeeds with the new configuration.