I wasn’t totally sold on the need for .mjs extension for es modules until I tried to dynamically write <script> tags. Really nice to have that in-band meta data!
If (ext == ‘.mjs’) {
return `<script type=“module”…`
} else {
return `<script nomodule…`
}
cc/ @mathias
Replying to @popeindustries
A module-specific extension helps to distinguish between modules and classic scripts, too. Given a file, you don’t have to look at its entry point to figure out how it behaves.
7:22 AM - 4 Jul 2018
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.