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

deno bundle fails to resolve react/jsx-runtime #13389

Closed
pheuter opened this issue Jan 16, 2022 · 4 comments · Fixed by #15592
Closed

deno bundle fails to resolve react/jsx-runtime #13389

pheuter opened this issue Jan 16, 2022 · 4 comments · Fixed by #15592
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@pheuter
Copy link

pheuter commented Jan 16, 2022

I'm seeing an issue with this when trying to do deno bundle with react/jsx-runtime, created repro here with description of error: https://github.com/pheuter/hello-deno#blocking-issue.

Currently unable to bundle client-side code using react/jsx-runtime despite deno run working just fine using the same code and config:

» deno bundle --config deno.json client/index.tsx static/client.js
Check file:///Users/mark/src/pheuter/hello-deno/client/index.tsx
Bundle file:///Users/mark/src/pheuter/hello-deno/client/index.tsx
error: Unable to output during bundling.

Caused by:
    0: load_transformed failed
    1: failed to analyze module
    2: failed to resolve https://esm.sh/react@17.0.2/jsx-runtime from file:///Users/mark/src/pheuter/hello-deno/client/index.tsx
    3: Cannot resolve "https://esm.sh/react@17.0.2/jsx-runtime" from "file:///Users/mark/src/pheuter/hello-deno/client/index.tsx".
» deno --version
deno 1.17.3 (release, aarch64-apple-darwin)
v8 9.7.106.15
typescript 4.5.2

Oddly enough, the issue appears to go away when I explicitly do /** @jsxImportSource https://esm.sh/react@17.0.2 */ in every tsx file, which I'm trying to avoid with this optimization in the first place.

@stale
Copy link

stale bot commented Mar 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 17, 2022
@kitsonk kitsonk added bug Something isn't working correctly cli related to cli/ dir labels Mar 17, 2022
@stale stale bot removed the stale label Mar 17, 2022
@kitsonk
Copy link
Contributor

kitsonk commented Mar 17, 2022

We need to inject this module into the bundle when present in the config. Even though it is in the module graph, because swc does the bundling, it isn't away of it directly.

@milky2028
Copy link

I also see this issue when doing deno compile.

@lucacasonato
Copy link
Member

Fixed by #15561.

Still needs a test

bartlomieju added a commit that referenced this issue Jul 6, 2023
This commit adds some regression tests for using `jsxImportSource` in
the config file in combination with an import map.

These underlying issues were fixed by #15561.

Closes #13389
Closes #14723

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants