-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Add mimetype for extension .mjs #75896
Comments
I propose to add a mapping of file extension .mjs to mime type "text/javascript". This extension is being used by Node.js for support of ECMAScript Modules (ESM). |
I see that when this landed it appears that it was removed from landing on "Python 2.7, Python 3.6, Python 3.7". Is there any chance to revisit this decision? I dug into the mimetype code and it doesn't appear that there is a way to rely on operating system mimetypes for systems aside from Windows... as such this is going to be a fairly large experience gap for people developing front-end applications that utilize the file extension on any version other than 3.8, which will likely take quite a while to be distributed as a default in various OS distributions. |
It's technically a new feature. New features are not added to existing releases unless there is a very compelling reason. |
There are a number of tutorials that suggest using the .mjs extension for working with ESM modules for front end development. https://developers.google.com/web/fundamentals/primers/modules <https://developers.google.com/web/fundamentals/primers/modules\> There are many tutorials that suggest web developers use As such I would like propose that this is a bug fix, rather than a feature, as popular browser workflow is going to be broken without an obvious way to fix it for anyone using python right now.
|
Christian Heimes is right: it is a new feature, not a bug fix. You can try to convince release managers (Benjamin and Ned, I've added you to nosy list) but I suspect you'll get a rejection. |
Thanks for cc'ing the other folks. I help run the Node.js release + LTS team... so I 100% understand the balance necessary to keep a stable API. In this particular case I would gauge that this has a near 0 case for breakage, but leaving it unpatched has a high risk of breaking user expectations https://github.com/search?q=extension%3Amjs+function&type=Code This is a really heavy handed search against github showing 13k+ files with the .mjs extension that include the word "function" |
Also wanted to point out some prior art of a mimetype (json) being backported to all active runtimes |
We have generally made an exception to the "new feature" rule for mimetypes. That is, we don't really consider a mimetype addition to be a new feature in the sense that our backward compatibility rules mean. It is true that an application could work on x.y.z and break on x.y.z-1, but this isn't because an *API* present in x.y.z is not there in x.y.z-1. is more akin to a bugfix (it threw an exception before, now it works). Think of the absence of the mimetype rule as a bug, rather than its presence as a feature. And yes, this is a policy evolution. This way of looking at mimetypes changes has been in effect for....maybe five years now?...and before that we treated them as features. But then, too, before that we required there be an actual IANA accepted RFC, but that requirement too has had to evolve as mimetype management became more decentralized. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: