create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

After upgrading to React 18 version and CRA 5 can not make a build

Open sadashiv-sumasoft opened this issue 3 years ago • 1 comments

My React application code compiled successfully but when hit yarn build command failed with following error.

Module not found: Error: Can't resolve 'D:/projects/updateui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js' in 'D:\projects\updateui\src\components'

I have upgrade my application React 16 and CRA 4 to React 18 and CRA 5. Any suggestion will be appreciated.

sadashiv-sumasoft avatar Aug 10 '22 14:08 sadashiv-sumasoft

delete the node_modules and lock file and then npm install

check this as well // Before import { render } from 'react-dom'; const container = document.getElementById('app'); render(<App tab="home" />, container);

// After import { createRoot } from 'react-dom/client'; const container = document.getElementById('app'); const root = createRoot(container); // createRoot(container!) if you use TypeScript root.render(<App tab="home" />);

thakuranujsingh avatar Aug 29 '22 07:08 thakuranujsingh