Webpack takes forever to run?


#1

I’ve been working on a project that uses React and ES6 and building all of it using webpack (the project name is “arrow-fine”). There are a few other dependencies as well, like react-leaflet (for maps), react-autocomplete and react-geolocated, but otherwise I feel like it’s a pretty straightforward project. I could be wrong about this, though; I recently had to switch back to pnpm from npm because my node_modules directory was filling up my available disk space and causing errors.

Anyways, webpack now takes a ridiculous amount of time to build my project. The last successful run took 148 seconds, and my most recent run hasn’t completed yet after at least five minutes of waiting. I didn’t even add any new packages or make substantial changes in that time. Any ideas on how to tweak webpack performance? My productivity has ground to a halt because of this.

UPDATE: The run just completed. 496 seconds! That’s eight minutes! How?!


#2

Things seem to have settled down some, as build times are back down to 50-70 seconds, which is what I normally expect on Glitch. This still seems really long compared to the webpack builds I’m used to on my local computer, though, so I’d still like some comments on whether Glitch is just that much slower or if there’s anything I can do to improve performance.


#3

Install times vary depending on the modules used. For those with components that require compilation or very large modules they can be quicker or similar to local install times on Glitch due to our caching (see https://medium.com/glitch/tackling-the-biggest-pain-points-in-web-development-57d64afe19dc for some examples). But for smaller packages, Glitch, or indeed any shared host, is unlikely to match the performance of your local, dedicated dev machine. With that said, the install time for me from a remix of arrow-fine was 14 seconds, so perhaps you encountered some temporary performance issues on the host your project was on at the time.


#4

Thanks Gareth. I should probably clarify, I’m talking about webpack times for compiling Javascript, not the npm/pnpm install time.