This is a Hugo bug. The first two extensions are not internally associated with application/javascript. I’ll log it and submit a fix. I cannot think of a work-around at the moment.
The files I’m fetching via resources.Get are regular *.js extension files that are giving the wrong Media Type text/plain. Could this bug be the cause of that error?
With resources.GetRemote we do not blindly trust the content.
We perform some background checks, looking at the response header from the server, the file extension, and fingerprinting the file itself. Part of this depends on the MIME database on the system where Hugo is running. In this case, when we queried your system, the first extension for “application/javascript” is .jsm, and Hugo currently doesn’t recognize that as a valid extension for JS files.
Install the “hugo extended” snap package. The snap has an older version (Ubuntu 18.04?) of the mime database. Make sure the known limitations of the snap package aren’t going to be a problem for you.
I would not use the term work-around, as that sounds a little like a hack. I do agree that Hugo should have these configured by default, but we’re not going to ever have all the media types etc. in the world configured, which is why this can be added/modified via end user configuration.
I agree, but in this case a user would have no idea what to add. I had to debug to figure out which extension it was picking up, and from where. I think Go’s idea of loading MIME type databases from the local system is a bit sketchy.