Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build takes 1-2 hours to build #4785

Closed
clu3 opened this issue Jul 18, 2018 · 3 comments
Closed

npm run build takes 1-2 hours to build #4785

clu3 opened this issue Jul 18, 2018 · 3 comments

Comments

@clu3
Copy link

clu3 commented Jul 18, 2018

First off, thank you for everything.

I have a fairly big react app (200K locs , css excluded), and recently it takes me hours to npm run build (It used to be like 9min which was aweful as well but i could still live with it). Some change in the last few weeks, which we haven't been able to identify what because our package.json still looks fine, has increased the build time from 10m to 1-2hours, sometimes 3 on my laptop. And the build process usually runs out of memory and dies on my colleagues' machines.

We use react-router and react-loadable to split the code.

When I examine the build folder, i still have like
main.ad2ec57c.js 3.5M
main.ad2ec57c.js.map : 21M
and lots of other chunks of size 5-100K.

Can you pls point me some direction on how to go about solving this?

@gaearon
Copy link
Contributor

gaearon commented Jul 18, 2018

Can you disable sourcemaps?

Put

GENERATE_SOURCEMAP=false

in your .env file and try again.

Also it would help to have more info about react-scripts version, etc.

@clu3
Copy link
Author

clu3 commented Jul 18, 2018

Thanks @gaearon for the really quick reply
I'm running Ubuntu 16 LTS and have

"react": "^16.3.2",
"react-scripts": "^1.1.4",
node v8.1.2
npm 6.0.1

And here is my complete package.js : https://gist.github.com/clu3/d008f57f77dbff284427aa4666fb3b58

Im trying to re-build with no source map. It still looks like it's taking time. So i'll go ahead and post my comment here, hoping i'll get something figured out earlier.

Update
It's finished building, now it's like roughly 10-15min

@Timer
Copy link
Contributor

Timer commented Jul 23, 2018

This application sounds massive! With source maps disabled, there's no way we're going to squeeze more performance out of your build unless if you upgrade to the new alpha and give it a try -- it has a lot of caching on by default, but be aware it has its own set of bugs/issues which causes suboptimal bundle distribution. Stay tuned!

@Timer Timer closed this as completed Jul 23, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants