Since Hugo v0.84.2, my JavaScript size went to 400 MiB!

Hi there!

I had my website setup but I created some problems so I had to revert to a previous commit. Since I did that, I noticed my website’s JS that was 16 KiB previously, now turns out to be 407 MiB!

After investigation, I narrowed this down to 0.84.2 update. Till 0.84.1, the JS is building fine. I just tried every version now and as I installed 0.84.2, the size went to 407 MiB again! Since this is my website’s main bundle, my website now doesn’t load if I continue using the latest Hugo. This also increased my build time from 2 second to around 11 seconds.

I’m not sure what change exactly could cause this. Any guidance would be super helpful.

The problem persists in 0.85.0 too. Could this be checked please? This is my repo: GitHub - Hrishikesh-K/Blogfolio: My Blogfolio made in Hugo, hosted on Netlify. and the file I’m taking about is: /layouts/index.logic.js. It’s a template exported by config.toml and gets exported to /public/js/logc.js.

This is a JS minification bug that was introduced in tdewolff/minify v2.9.17.

Not sure which of these commits is the culprit…

Workaround in site configuration:

[minify]
minifyOutput = true
disableJS = true

If I comment out the manageSearches function, no problems. I am suspicious of how the nested switch statements are handled with bb43a7e.

1 Like

Hi @jmooring,

Thank you very much, those are some interesting findings! Looks like there’s an open issue regarding the same already on the minify library: JS: switch statement regression · Issue #426 · tdewolff/minify · GitHub.

I think, the best way for me as of now is to use 0.84.1. Thank you for taking time to look into this.

cc/ @tdewolff

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.