Skip to content
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

React/jsx-runtime subpath './jsx-runtime' not resolved for types in Deno 1.41.0 #22538

Closed
nestarz opened this issue Feb 22, 2024 · 1 comment
Closed

Comments

@nestarz
Copy link

nestarz commented Feb 22, 2024

Environment:

  • Deno version: 1.41.0

Description:
After upgrading to Deno 1.41.0 from 1.40.x, I encountered an issue concerning the resolution of the package subpath './jsx-runtime' for React 18.2.0. This issue wasn't present in the previous version of Deno.

Error Message:
When attempting to use import { jsx as _jsx } from "npm:react@18.2/jsx-runtime"; the following error is encountered:

error: Uncaught Error: Failed resolving package subpath './jsx-runtime' for '/Users/Library/Caches/deno/npm/registry.npmjs.org/react/18.2.0/package.json': [ERR_PACKAGE_PATH_NOT_EXPORTED] Package subpath './jsx-runtime' is not defined for types by "exports" in '/Users/Library/Caches/deno/npm/registry.npmjs.org/react/18.2.0/package.json'

This issue seemingly arises from the JSX commonjs detection code within Deno, as React (as of version 18.2.0) does not yet support esm.

Steps to Reproduce:

  1. Upgrade Deno from version 1.40.x to 1.41.0.
  2. Attempt to import jsx from React's jsx-runtime using the specified syntax above.
  3. deno publish
  4. Observe the error regarding the failed resolution of package subpath './jsx-runtime'.

Expected Behavior:
The package subpath './jsx-runtime' should be resolved without errors, allowing for the successful import and usage of React's JSX runtime in Deno.

Actual Behavior:
The import fails due to an uncaught error regarding the resolution of the package subpath './jsx-runtime'.

I suspect there might be a bug in Deno's JSX commonjs detection code affecting compatibility with React's current lack of esm support. Would appreciate any insights or assistance in resolving this issue. Thank you!

@nestarz nestarz changed the title React/jsx-runtime subpath './jsx-runtime' not resolved in Deno 1.41.0 React/jsx-runtime subpath './jsx-runtime' not resolved for types in Deno 1.41.0 Feb 22, 2024
@nestarz
Copy link
Author

nestarz commented Feb 22, 2024

Closing in favor of #18203

@nestarz nestarz closed this as completed Feb 22, 2024
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

No branches or pull requests

1 participant