question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsx-runtime missing

See original GitHub issue

It would be really great if Crank had a jsx-runtime. As hint, please find the Preact counterpart here.

Would allow the following tsconfig.json entries:

  "jsx": "react-jsx",
  "jsxImportSource": "@b9g/crank"

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
xdev1commented, Aug 9, 2022

@darrylcousins Thank you very much, Darryl, for all that info about how JSX can be configured with Vite. This was indeed very informative and helpful. I’ve not used Vite yet, but after your posts above, I’ll give it a try … actually really very nice … Nevertheless, as not everybody uses Vite and jsx-runtimes are some kind of standard now, it would still be great if Crank had a jsx-runtime, I guess 😉

1reaction
darrylcousinscommented, Aug 7, 2022

Hi,

The example offered for esbuild config options is:

export default defineConfig({
  esbuild: {
    jsxInject: `import React from 'react'`
  }
})

I’ve tested the following and it works. Of course it complains that Identifier 'createElement' has already been declared if I do explicitly define the import in any jsx file:

export default defineConfig({
  esbuild: {
    jsxFactory: 'createElement',
    jsxFragment: 'Fragment'
    jsxInject: `import {createElement, Fragment} from '@b9g/crank'`
  }
})

Hope that helps.

Sincere regards, Darryl Cousins

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'react/jsx-runtime' · Issue #2119 - GitHub
Current behavior: I've upgraded to v11, I received the following error when the run the test suite. ○ Test suite failed to run...
Read more >
Uncaught Error: Cannot find module 'react/jsx-runtime'
js file. I tried adding it the .js back to webpack's resolve.extensions and the error disappeared. In hindsight I guess this make senses....
Read more >
Module not found: Can't resolve 'react/jsx-runtime' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your terminal in...
Read more >
cannot find module '@emotion/react/jsx-runtime' or its ...
Cannot find module 'react/jsx-runtime' · Issue #2119 · emotion-js . ... linux/amd64 7:54:18 PM: Installing missing commands 7:54:18 PM: Verify run directory ...
Read more >
Introducing the New JSX Transform – React Blog
The functions inside react/jsx-runtime and react/jsx-dev-runtime must only be used by the compiler transform. If you need to manually create ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found