3 ms·
What I suspect is going to happen is that frontend people will just shrug and adopt the .mjs extension. Browsers don't care what extension you use as long as th
by segphault 9y ago
What I suspect is going to happen is that frontend people will just shrug and adopt the .mjs extension. Browsers don't care what extension you use as long as the mime type sent by the server indicates that the file is javascript.
- exogen 9y agoNot exactly the entire story. Browsers don't care about the extension, true, but they still need to know whether to parse the script as a module or not, by using: <script type="module">
- strkek 9y agoHey this is cool! How come I haven't heard of <script type="module"> before. I guess I should seriously subscribe to a newsletter or something.
- Androider 9y agoHow is this going to work with the gazillion existing NPM packages and projects using Babel? Right now you just require a Babel runtime first, then use import for everything else not caring what type of modules they are. The acceptance test for proper module support in Node.js should simply have been that you can remove the Babel wrapper in an existing project that uses imports instead of requires :(
- arackaf 9y agoI doubt it - so long as @std/esm exists, I imagine that will continue to be the low-friction approach, especially considering how much better it is at CJS interop, supporting __dirname, __filename, etc.