HUGO

ES6 script in HEAD element corrupted by `hugo --minify`

I was able to fix the problem by converting the ES6 syntax to ES2015 and --minify didn’t mess with the code and everything works as expected.
Note: I didn’t run into this error until I built for production, because I wasn’t using minify when using hugo server.

I was using code similar to what is shown in the <script> element of this Alpine.js V3 example. data — Alpine.js

This is an upstream bug:
https://github.com/tdewolff/minify/issues/429

1 Like

Thank you, that is exactly the issue.

This was fixed with 9f73f9d, and will presumably be available in 2.9.21. Not sure when it will make its way to Hugo.

Here is the issue for Hugo to update the library.

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