[0.6] Attempted import error: 'createElement' is not exported from 'theme-ui' (imported as '_createElement').
See original GitHub issueDescribe the bug
In order to be able to install Next v10 (which work on React v17), I tried to include the latest theme-ui’s alpha version v0.6.0-alpha.4 and make them work together.
I will surely reverse my changes since theme-ui v0.6 is not in released yet, but I wanted just let you know that I have met this error during the npm running :
Attempted import error: 'createElement' is not exported from 'theme-ui' (imported as '_createElement').
And that happen only when I put Component
(which take the current dynamic route in Next):
import React from "react";
import { ThemeProvider } from "theme-ui";
import { theme } from "../styles/theme";
import Layout from "../components/layout";
import { AppProps } from "next/app";
/** @jsxImportSource theme-ui */
const App = ({
Component,
pageProps,
apollo,
isAuthenticated,
router,
}: AppProps ) => {
return (
<ThemeProvider theme={theme}>
<Layout {...pageProps}>
<Component {...pageProps} key={router.pathname} /> /** That one **/
</Layout>
</ThemeProvider>
);
};
If Component
is commented, then I can see the rest of the page working well (The Header and Footer provided by the Layout)
I’m wondering if I have missed something or if there is a bug from theme-ui
Expected behavior Don’t have that error and see the page display well
Additional context
- Next version: 10.0.3
- React version: 17.0.1
- Theme-ui version: 0.6.0-alpha.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Attempted import error: 'createElement' is not exported from ...
Hi, This error costed me a hackathon win ! basically at picker.web.js , it's not able to import createElement. if you go and...
Read more >Migrating - Theme UI
Themed components dict and other exports from @theme-ui/mdx are no longer reexported from theme-ui . Migration: Import it from @theme-ui/mdx instead. - import...
Read more >API - Theme UI
The jsx export is a React create element function for the classic JSX runtime intended for use with a custom pragma comment. It...
Read more >JSX Pragma - Theme UI
JSX Pragma. Theme UI uses custom JSX functions and JSX import source comments to allow you to style elements with values from your...
Read more >Getting Started - Theme UI
Create a theme object to include custom color, typography, and layout values. import type { Theme } from 'theme-ui'. export const theme: Theme...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this issue needs a change in the docs and Next.js example on our side.
We need to state clearly that
"classic"
and"automatic"
runtime."classic"
and"automatic"
runtime."automatic"
runtime by default. If you don’t modify your Babel config, you need to usejsxImportSource
pragma comment with it."classic"
runtime by default. If you don’t modify your Babel config, you need to usejsxFrag
pragma comment with it.jsx
is"automatic"
runtime (IMHO, this is probably subjective), because you don’t have to write any pragma comments, but you need to configure automatic runtime in your Babel config. Here’s how you do it — give users an example Babel config for Next.js / Gatsby / Any Popular Framework@dcastil @lachlanjc what do you think about it? Does it make sense?
We’ve significantly improved documentation on our JSX pragma, over here: https://theme-ui.com/guides/jsx-pragma
Going to close this for now, but please flag if there’s improvements we should make!