94% Asset Optimization.... just hanging


We recently started another new Bedrock/Sage project here, and the last 8 or so have been fine. This latest one, on a yarn build:production just sits there at 94%.

Tried on multiple systems, and always the same issue. No errors, just hangs for forever.

Any ideas?


I think I ran into a similar error at that same point (94%) that ultimately had to do with the ImageMin plugin webpack is using. In my case I didn’t need the image optimization (I was doing that by hand) so I just ripped it out and everything worked. If you need the plugin, you may be able to massage it a little to get it to work better. IIRC it can have some issues because it depends on system-level libraries to do image compression.


How’d you remove it exactly?


Think I just deleted these lines: https://github.com/roots/sage/blob/375b06a22bd61dcdc6d80b248812e9cb8c86a238/resources/assets/build/webpack.config.optimize.js#L11-L24


Awesome, removed that and the site can actually be built for production now. Not sure what changed, I have 10+ other Bedrock/Sage sites locally that still compile just fine.


Ah damn, removing just those lines and the site is still creating files like dist/images/logo-1b02f538.svg but the site is now just looking for the non-hashed ones.


I don’t believe those lines do the filename hashing. Try deleting the dist folder and re-running your yarn command.