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.

Can't build a simple CRA app with v11.8.0

See original GitHub issue

Current behavior:

A build of a CRA app with React 17, MUI 5 (thus requiring emotion) fails quickly with:

Creating an optimized production build...
Failed to compile.
Attempted import error: 'useInsertionEffect' is not exported from 'react' (imported as 'useInsertionEffect$1').

This looks like the lib erroneously try to require something that’s only available in React 18, while my app uses React 17.

To reproduce:

I can build a CSB if you feel it’s better, but really the steps are:

  1. Create a new CRA
  2. Add MUI 5 and emotion
  3. Setup MUI, Use a MUI component
  4. npm run build

Expected behavior:

Build succeeds

Environment information:

  • react version: 17.0.2
  • @emotion/react version: 11.8.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Andaristcommented, Feb 19, 2022

I’ve created a fix here and verified that it should work with CRA. I’m waiting for the CI and stuff but I should be able to release this somewhat soon.

0reactions
ahmedkhan847commented, Feb 19, 2022

I am also facing the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript and React using create-react-app - Level Up Coding
This tutorial will show you how to quickly get started building React applications using TypeScript without needing any configuration by using create-react-app ......
Read more >
Docker : Run a React app in a docker - 2020 - BogoToBogo
Create React App (CRA) is a tool to create a blank React app using a single terminal command. Besides providing something that works...
Read more >
How To Set Up a React Project with Create React App
Starting a new JavaScript project with React used to be a complicated process. But now, Create React App includes all the JavaScript ...
Read more >
create-react-app is not working since version 4.0.1
So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app.
Read more >
Don't use create-react-app: How you can set up your own ...
CRA is not boilerplate. It's build tool itself. You can DIY same kind of setup but you are really underestimating how much work...
Read more >

github_iconTop Related Medium Post

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