Matt Leaverton

Software and Electronics.

Currently Principal Software Engineer at Glowforge

Connect with me:

ES Modules in Vanilla JS

I "learned" Javascript back in the good old days when jquery was the cutting edge, so it's no surprise that I find myself drawn to Vanilla JS as my weapon of choice.

Javascript build systems make me sad (a discussion for another time), but so many new and existing javascript libraries target build systems and cannot be used in Vanilla JS, or so I thought.

It turns out that it's just as simple as adding type="module" to the script tag, with no arcane build configurations required.

<script type="module" src="main.js"></script>