4 ms·
>I don't like the `.mjs` extension, but I understand the need for it, and I'm just glad that modules are finally here. I read that a lot. Why do people don't l
by coldtea 9y ago
>I don't like the `.mjs` extension, but I understand the need for it, and I'm just glad that modules are finally here.
I read that a lot. Why do people don't like the new extensions?
Seems like the most elegant and programmatically more performant and less hassle free, solution to the issue.
Everything else looks like a terrible kludge.
- _pmf_ 9y ago> I read that a lot. Why do people don't like the new extensions? Probably because you'll end up with .mts, .mjsx, .mts, .mtsx.
- coldtea 9y agoSo? If they are different types, it makes sense to have different extensions (e.g. if mts implies typescript module).
- josteink 9y ago> mts implies typescript module Or mpeg transport stream: https://en.m.wikipedia.org/wiki/MPEG_transport_stream https://en.m.wikipedia.org/wiki/MPEG_transport_stream
- kdkdkdk333ke 9y agoThey usually use .ts extension, or .tsv, .tsa according to the wiki article you just linked. .mts is unheard of.
- coldtea 9y agoWell, they can coordinate that like we coordinate mime types. I've chanced upon the "same extension for the same thing" as a problem maybe 2-3 times in 30+ years.
- bradstewart 9y agoI like that better than having to open a file and read its source to figure out what type of module it exports...
- batmansmk 9y ago"Import" was already decided to help the parser performing static analysis versus "require". Now "mjs" is introduced to make detecting if we are in front of a commonjs or module "faster". I'm sure the people who decided this are very bright, but the main goal was how to be nice with v8, and not how to be easy for developers. Changing from js to ts is an inconvenience sufficiently big enough to adopt flowtype instead.