-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate if the named resource transformation locks can be made more robust #8370
Comments
What does "Chrome and Firefox refuses to load the JS source" mean? There are specific message in both browsers in the console. Please post those here to be sure what "refusing" refers to. |
Chrome:
Firefox (In German):
It's basically the same problem, the generated fingerprint doesn't match the resource... |
So, there are certainly enough sites in the wild that are still working, so fingerprinting isn't broken. What happens in your situation is a little hard to say without additional context, e.g. the site source. |
Where are you hosting? There MUST NOT be any code optimization/minification AFTER you fingerprint the hash. If you host for instance on Netlify you MUST NOT enable minification of CSS and JS on Netlify. That is the most common cause why the hash differs. |
I host here on GitHub, but it also happens when serving from Hugo ( @beb: I've created a (initial) striped down test site here: cmahnke/hugo-0.82-test |
I can reproduce the problem, but I don't understand why you minify, concatenate, and then minify again. This will fix the problem, but I'm not sure why. Change: {{- $mainOpts := dict "targetPath" "js/main.js" "defines" $defines "minify" true -}} To: {{- $mainOpts := dict "targetPath" "js/main.js" "defines" $defines "minify" false -}} See https://github.com/cmahnke/hugo-0.82-test/blob/main/layouts/partials/head.html#L48 |
Totally a wild guess (so probably a wrong guess): github.com/tdewolff/minify/v2 was upgraded from v2.9.13 to v2.9.15 between Hugo 0.81.0 and 0.82.0 in order to fix #8332. I suppose compiling Hugo 0.82.0 with go.mod pointing to |
|
Hi @tdewolff! When you have time, could you please help take a look at this? Many thanks! |
@anthonyfok and @tdewolff, I am unable to replicate the test results from my previous comment, so please hold off on investigating tdewolff/minify v2.9.15. |
I built Hugo from source at 7ed56c6, tested with cmahnke's repository, no problems. So the problem appears to be related to the change from tdewolff/minify 2.9.13 to 2.9.15 (we skipped 2.9.14). But I still don't understand:
|
@jmooring: The answer to question one is quite simple: Probably it's just a lack of knowledge / wrong assumptions: |
@cmahnke: It looks like esbuild's minify doesn't do anything special. See https://esbuild.github.io/api/#minify, in particular:
So until this issue gets further attention, don't ask esbuild to minify.
I agree. |
Thanks for referring me to the issue. I'm not sure I can help on this one though, this seems to be a problem in Hugo or in the setup more than a problem of minify, or am I mistaken? Keep me updated if this requires changes to |
So, this construct looks funky: https://github.com/cmahnke/hugo-0.82-test/blob/main/layouts/partials/head.html#L38 I'll paste in the entire construct:
I will keep this issue open to see if we can improve/fix this (I suspect the caveat is the reuse of {{- $defines := dict "process.env.NODE_ENV" `"production"` -}}
{{- $mainOpts := dict "defines" $defines "minify" true -}}
{{- $main := resources.Get "js/main.js" | js.Build $mainOpts | fingerprint -}} |
minify
in 0.82.0?
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes, Hugo 0.81.0 extended build from GitHub works without any issues
After upgrading Hugo to 0.82.0 the following statement(s) don't work anymore as expected:
changing the second to the following (as suggested here for a similar problem) doesn't work either:
After upgrading Chrome and Firefox refuses to load the JS source.
Has there been a change how to use the fingerprinting or might this be a bug?
I haven't been able to investigate the issue any further (yet). I've downgraded back to 0.81.0...
The text was updated successfully, but these errors were encountered: