Investigating it seems it’s due to a comment at the end of some libraries that cause the error, like this: //# sourceMappingURL=scrollMonitor.js.map/**
Yes, that was only an example, I can’t find nothing better or more specific.
I don’t know what is the tool used in Hugo to concatenate but maybe the problem comes from there?
I think your advice to manually delete the comment is a dirty approach. Also, the libraries that generate this error are many and I download them via npm/yarn then when I update them the edit will be overridden.
If you want to automate this, add a script to your build process that removes the comment before deploying.
Edit: Actually this wouldn’t work in your case since you are using fingerprint and any script that modifies the JS post-build would change the file hash.
If you believe you’ve found a bug in the minifier, you can post the report upstream at https://github.com/tdewolff/minify. There was a previous report that was resolved. However, they didn’t add tests in their fix, so the bug could be back.
That’s an idea but on this project I use a lot of JS libraries so I need to concatenating all of them in one single file. Also, it seems a long term issue to solve, am I wrong?
I see.
For now, I guess you’d have to weigh the cost of a web request for each JS file, vs a single file, and see how this affects your site performance.