jsxImportSource does not work with nextjs 12.0.8 and react 17 #2093
-
Hi, according to "https://theme-ui.com/guides/jsx-pragma#with-swc" I should be able to add "jsxImportSource": "theme-ui" to my tsconfig.json to configure JSX to use the automatic runtime (globally, for your entire app), and no longer need to use the custom pragma comments in your files. But after following the above I still get |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @daniellin215, could you take a look at this CodeSandbox, I've just prepared for you: https://codesandbox.io/s/theme-ui-simplest-nextjs-importsource-yhcbe?file=/pages/index.tsx If looking at this doesn't help you, could you please provide a reproduction of your issue? |
Beta Was this translation helpful? Give feedback.
-
Hey @hasparus , thanks for the example. It looks like I have |
Beta Was this translation helpful? Give feedback.
Hey @hasparus , thanks for the example. It looks like I have
theme-ui
and not@theme-ui/core
in mypackage.json
. After I uninstalledtheme-ui
and followed your setup, specifically the addition of"jsx": "preserve", "jsxImportSource": "@theme-ui/core"
worked! (i did not have to have/** @jsxImportSource theme-ui */
at the beginning of each file that usessx
. However, withouttheme-ui
, I am not able to import and use some components such asBox
etc.