3 ms·
What drew you to mjs?
by lainga 7y ago
What drew you to mjs?
- tobiu 7y agoYou mean the file name extension .mjs? If so: https://medium.com/passpill-project/files-with-mjs-extension-for-javascript-modules-ced195d7c84a https://medium.com/passpill-project/files-with-mjs-extension... It got popular in nodejs first to name files containing JS modules .mjs, but it starting to get a standard inside browsers as well. You can find a lot more references in case you google for it, e.g.: https://dev.to/saigowthamr/js-modules-are-now-supporting-in-browsers-13fn https://dev.to/saigowthamr/js-modules-are-now-supporting-in-... Best regards Tobias
- spankalee 7y ago| but it starting to get a standard inside browsers as well Browsers don't care about the file extension, just the mime-type. Node supports modules with any extension now as well. I wouldn't use .mjs, it causes lots of problems.
- tobiu 7y agoin case it does cause problems, it would be very easy to change the file names. the dist versions do use .js files, since webpack compiled modules are not real ones. feel free to open a ticket inside the issues tracker with more input about the problems and i will look into it.
- mrspeaker 7y agoI thought (hoped!) that `mjs` was just a hack that node used to get around the fact they couldn't do native javascript modules with .js extensions nicely - but (with --experimental-modules for now, but default eventually) the `mjs` file extension hack should be gone forever soon (I thought!).