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.

signals/react: 'default' is not exported by react/jsx-runtime

See original GitHub issue

When trying to generate a production build in a Vite react app, we get the following error:

'default' is not exported by react/jsx-runtime, imported by node_modules/@preact/signals-react/dist/signals.module.js

It appears this error originates from these lines https://github.com/preactjs/signals/blob/main/packages/react/src/index.ts#L9-L10, where it’s using default imports for the two runtimes, while the jsx-runtime package appears to only provide named exports?

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

3reactions
cafreemancommented, Nov 14, 2022

Update on this, it looks like there is an issue with how @preact/signals-react incorporates with the JSX runtime. You can circumvent this by updating vite react plugin to use the classic jsxRuntime, though I’m unsure what the tradeoffs are there, e.g.:

export default defineConfig({
  plugins: [
    react({
      jsxRuntime: "classic",
    }),
  ],
});
2reactions
govindg312commented, Nov 10, 2022

Running into the same issue while building a Vite TypeScript React application.

Edit: @cafreeman - I changed the version to 1.1.1 on my package.json and it has fixed the issue with the build. Although, probably need to take a deeper look to fix in future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: 'default' is not exported by react/jsx-runtime, imported by ...
Description calling preact signal for state management causes error in react-ts app To Reproduce wails init -n myproject -t react-ts cd frontend &&...
Read more >
Error: 'jsxs' is not exported by node_modules/react/jsx-runtime ...
I ended up having to add react/jsx-runtime to external in the ... export default [ { input: 'src/Icons/index.ts', output: [ { file: ...
Read more >
TSConfig Option: jsxImportSource - TypeScript
Declares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx as "react-jsx" or "react-jsxdev" which...
Read more >
Attempted import error 'X' is not exported from | bobbyhadz
To solve the error, make sure the module has a named export and you aren't mixing up named and default exports and imports....
Read more >
can't resolve 'react/jsx-runtime' - You.com | The AI Search ...
map((product, index) => { return ( <MenuItem key={index} value={product}> {product} </MenuItem> ); })} </Select> </> ); }; export default App;.
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