Build failure with 0.92

I upgraded to 0.92 (from a much older 0.74.3 release…) and getting this build error (which obviously was not happening with 0.74.3):

Error: Error building site: MINIFY: failed to transform "quickstart/web/js/jamba-quickstart-frontend.js" (application/javascript): too many nested expressions on line 1 and column 137156
    1: ...}(t,e))),Xe()}var o},Js.prototype.invoke_...

Is this something I am doing wrong or an issue with hugo?

Thanks

I just wanted to add that running this file through MINIFY is somewhat pointless and removing this phase obviously fixes the issue. But it is weird that something that used to work with MINIFY no longer does…

Unfortunate? Yes.
Weird? Not really.

We use tdewolff/minify for general purpose minification, and we have seen some regressions (and subsequent fixes) as that module matures.

For JS minification, look at the ESBuild options.

It is possible that the problem you are experiencing has already been resolved upstream. We currently use tdewolff/minify v2.9.22, but the latest release is v2.9.27. It would be helpful if you could post the JS that failed to minify.

If you are fine with me posting a 33Kb (compressed) file on this forum then I am totally fine with it. It is generated by Kotlin/Js so it is in a way quite “minified” but that doesn’t mean that running it through minify should fail (especially when it used to not fail). Let me know if that is ok.

Proceed, or use a gist, pastebin, etc.

I created a gist: Hugo 0.92 Minify failure · GitHub

Thanks for posting this. I have the data required for testing and/or logging another issue as needed. Feel free to delete your gist. Thanks again for your help.

I was able to reproduce the problem with the latest version of tdewolff/minify:

It has purportedly been fixed in v2.9.28.

Happy to know you were able to reproduce the problem. I will delete the gist.

I am seeing a similar error on the ‘/js/index.js’ file in the Newsroom theme. newsroom | Hugo Themes It worked previously in 0.84.3. I need to download the latest theme and see if it is an issue for the current version of the theme. @Weru

hugo v0.92.0-B3549403+extended windows/amd64 BuildDate=2022-01-12T08:23:18Z VendorInfo=gohugoio
Error: Error building site: MINIFY: failed to transform "js/index.js" (application/javascript): unexpected ( in expression on line 256 and column 3
  256:   (function copyHeadingLink() {
         ^
Total in 626 ms

Sorry, false alarm. It looks like the latest build of the Newsroom theme corrects this issue. I’ll leave this here incase others run into the same error.

2 Likes