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.
Typescript offers various jsx compiling options.
This PR sets
compilerOptions.jsx
field to use legacyreact
value instead ofreact-jsx
.Other changes are just side effects of this action.
Reason:
Currently, we use React v17 on Lido widgets, and reef-knot also supports React v17.
React v17 has an issue with ESM because it has no
exports
field in thepackage.json
.This can cause such error during building a based on react v17 project, which uses ESM and imports reef-knot:
It happens because of the way how ESM in node.js is defined. In modules with a
package.json
containing"type": "module"
imports in.mjs
or.js
files must be fully specified (with extensions), or it can be solved by theexports
field.It worked before because reef-knot was built as a CJS module.
The issue is fixed in react v18 – they've added the
exports
field topackage.json
, so we can switch back toreact-jsx
option after migrating to react v18.More info: