-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
mime: incorrect mime-type for .mjs files on windows (text/plain instead of application/javascript) #68591
Comments
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
We added the unfortunate exception after many different people reported it as a bug. This is the first report of a problem with .mjs. Can you confirm that there is a registry setting on your machine overriding the default .mjs behavior? Do you know where that registry setting came from? |
This is what I see in my registry: If I delete the I have no idea where that registry setting came from. At least 2 devs in my company had it set, while at least 1 didn't have it set. Kind of annoying that arbitrary windows apps can add these entries. Note that it's not really that big of a deal if we don't fix this because I primarily develop in and deploy to Linux. This just came up recently when some devs were trying to run a go app under windows and getting all the javascript served as plain/text. It's definitely not as common as .js, but it is common enough that big libraries often release a .mjs version of the library (for example: https://pixijs.download/v8.2.4/pixi.mjs). I created the issue in the off chance other windows users were affected by it, but I'm also fine with just closing the issue as "won't fix" with breadcrumbs to the workaround of amending your registry. |
CC @neild. |
A colleague has this same entry on their Windows 11 machine:
My machine has no registry entry for either key. We don't currently have any guesses for what might have modified my colleague's registry to add this bonkers entry. |
This command will remove the .mjs content-type from a Windows registry, causing Go (and presumably other web servers) to use the IANA-defined media type for these files:
|
Go version
1.21
What did you see happen?
This is identical to #32350 but .mjs instead of .js (I would have commented on the other thread, but it is locked to collaborators only).
.mjs is a fairly common javascript file extension for es modules (example: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#aside_%E2%80%94_.mjs_versus_.js)
I'm wondering if it would be acceptable to implement the same workaround found here, but for .mjs?
i.e. I could submit a PR to do:
What did you expect to see?
.mjs files should not be served with
text/plain
due to misconfigured registryThe text was updated successfully, but these errors were encountered: