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.

react-scripts@2.0 takes forever to build

See original GitHub issue

Recently, I upgraded a CRA project to the latest react-scripts v2 release (2.0.0-next.2150693d), and quickly realized that “yarn build” takes hours to build my project. Seems like it hangs at “Creating an optimized production build” for some reasons. That was quite unexpected since the previous version of react-scripts that I used (v1.1.5) could build the project just fine, though production build took a fairly long time (~15min).

FYI, before I was able to build, I had to manually update eslint to version 5.6.0, because react-scripts v2 requires it and a different version of eslint (3.9.1) detected higher up in the tree isn’t compatible with react-scripts@2.0, sorta similar to this known issue. I guess this approach could prevent users from breaking react-scripts initial dev dependency? (link).

Environment

  1. node -v: v8.12.0
  2. npm -v: v6.4.1
  3. yarn -v: (if you use Yarn): v1.9.4
  4. react-scripts: (if you haven’t ejected): 2.0.0-next.2150693d
  5. Ubuntu 16.04 LTS

Expected Behavior

yarn build succeeds

Actual Behavior

Get stuck at “Creating an optimized production build…” forever.

Reproducible Demo

Here’s my package.json

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Timercommented, Sep 23, 2018

I would definitely remove your rewire then with v2, it might be causing some bad configuration. Please try GENERATE_SOURCEMAP=false yarn build with no rewires applied.

Unfortunately, we’re not going to be of much help unless if you can share the project with us privately.

0reactions
Timercommented, Sep 26, 2018

Closing since we were not given a reproducing project

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create react app production build very slow on high end ...
The build still took around 20 minutes and the CPU usage only peaked to 20% and the memory peaked to around 2gb.
Read more >
Optimizing Performance - React
If you're benchmarking or experiencing performance problems in your React apps, make sure you're testing with the minified production build.
Read more >
react-app-rewired - npm
1) Install react-app-rewired · 2) Create a config-overrides.js file in the root directory · 3) 'Flip' the existing calls to react-scripts in npm ......
Read more >
Create React App
Set up a modern web app by running one command.
Read more >
What Does Create-React-App Actually Do? | by Andrew Mc
This might take a couple of minutes.” Using everything previously determined it runs your package manager to install the correct version of react-scripts...
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