This page showcases ES Modules in conjunction with the .mjs file extension.
View Source on Now or read the blog post.

/demo.mjs

import logo from './modules/logo.mjs'
document.querySelector('#placeholder').appendChild(logo())

/modules/logo.mjs

export default function createLogo () {
const el = document.createElement('svg');
el.innerHTML = `<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient x1="196.572434%" y1="228.815483%" x2="50%" y2="50%" id="a">
<stop offset="0%"/>
<stop stop-color="#FFF" offset="100%"/>
</linearGradient>
</defs>
<path d="M254 156.459299L367 356H141" fill="url(#a)" fill-rule="evenodd"/>
</svg>`;
return el;
}