Describe the bug.
React runtime resolution issue caused by outdated hardcoded jsx-runtime path
Problem
The current React version used in generator-react-sdk is outdated and is no longer aligned with other dependent AsyncAPI libraries such as @asyncapi/html-template.
The code currently hardcodes an internal React runtime path:
'react/jsx-runtime': require.resolve(
'react/cjs/react-jsx-runtime.production.min'
).replace(/\\/g, '/'),
However, this internal path is no longer exposed through React package exports in newer React versions.
This causes runtime resolution failures such as:
Error: Package subpath './cjs/react-jsx-runtime.production.min'
is not defined by "exports"
Example stack trace references packages like:
node_modules/.pnpm/@asyncapi/html-...
Suggested discussion points
- Should AsyncAPI packages align on a consistent React version strategy?
- Should the implementation switch to the public runtime entrypoint instead?
Example:
require.resolve('react/jsx-runtime')
- Is backward compatibility with older React versions still required?
I wanted to open this issue first to discuss the preferred direction with maintainers before continuing with a PR implementation.
Expected behavior
running
Screenshots
Error: Package subpath './cjs/react-jsx-runtime.production.min' is not defined by "exports" in node_modules.pnpm@asyncapi+html-template@3.5_38169f94417d5abe6c7e65de49492da1\node_modules\react\package.json at exportsNotFound (node:internal/modules/esm/resolve:313:10)
dependencies:
nestjs-asyncapi 2.0.1
├─┬ @asyncapi/generator 2.11.0
│ ├─┬ @asyncapi/generator-components 0.6.0
│ │ └─┬ @asyncapi/generator-react-sdk 0.2.25
│ │ └── react 17.0.2
│ └─┬ @asyncapi/generator-react-sdk 0.2.25
│ └── react 17.0.2
└─┬ @asyncapi/html-template 3.5.6
├─┬ @asyncapi/generator-react-sdk 1.1.3
│ └── react 17.0.2
├─┬ @asyncapi/react-component 3.1.3
│ ├── react 18.3.1 peer
│ ├─┬ react-dom 18.3.1 peer
│ │ └── react 18.3.1 peer
│ ├─┬ react-error-boundary 4.1.2
│ │ └── react 18.3.1 peer
│ └─┬ use-resize-observer 9.1.0
│ ├── react 18.3.1 peer
│ └─┬ react-dom 18.3.1 peer
│ └── react 18.3.1 peer
├── react 18.3.1
└─┬ react-dom 18.3.1
└── react 18.3.1 peer
How to Reproduce
- I first did this
- I then did this
- And so on . . .
🖥️ Device Information [optional]
- Operating System (OS):win 11 pnpm10
- Browser:
- Browser Version:
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
Yes I am willing to submit a PR!
Describe the bug.
React runtime resolution issue caused by outdated hardcoded jsx-runtime path
Problem
The current React version used in
generator-react-sdkis outdated and is no longer aligned with other dependent AsyncAPI libraries such as@asyncapi/html-template.The code currently hardcodes an internal React runtime path:
However, this internal path is no longer exposed through React package exports in newer React versions.
This causes runtime resolution failures such as:
Example stack trace references packages like:
Suggested discussion points
Example:
I wanted to open this issue first to discuss the preferred direction with maintainers before continuing with a PR implementation.
Expected behavior
running
Screenshots
Error: Package subpath './cjs/react-jsx-runtime.production.min' is not defined by "exports" in node_modules.pnpm@asyncapi+html-template@3.5_38169f94417d5abe6c7e65de49492da1\node_modules\react\package.json at exportsNotFound (node:internal/modules/esm/resolve:313:10)
dependencies:
nestjs-asyncapi 2.0.1
├─┬ @asyncapi/generator 2.11.0
│ ├─┬ @asyncapi/generator-components 0.6.0
│ │ └─┬ @asyncapi/generator-react-sdk 0.2.25
│ │ └── react 17.0.2
│ └─┬ @asyncapi/generator-react-sdk 0.2.25
│ └── react 17.0.2
└─┬ @asyncapi/html-template 3.5.6
├─┬ @asyncapi/generator-react-sdk 1.1.3
│ └── react 17.0.2
├─┬ @asyncapi/react-component 3.1.3
│ ├── react 18.3.1 peer
│ ├─┬ react-dom 18.3.1 peer
│ │ └── react 18.3.1 peer
│ ├─┬ react-error-boundary 4.1.2
│ │ └── react 18.3.1 peer
│ └─┬ use-resize-observer 9.1.0
│ ├── react 18.3.1 peer
│ └─┬ react-dom 18.3.1 peer
│ └── react 18.3.1 peer
├── react 18.3.1
└─┬ react-dom 18.3.1
└── react 18.3.1 peer
How to Reproduce
🖥️ Device Information [optional]
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
Yes I am willing to submit a PR!