WORKING WITH ES6 MODULES
One of ECMAScript 6's most significant introductions was a specification for modules. The specification in many ways is simpler than its predecessor module loaders, and native browser support means that loader libraries and other preprocessing is not necessary. In many ways, ES6 module system unifies the best features of AMD and CommonJS into a single specification.
Module Tagging and Definition
ECMAScript 6 modules exist as a monolithic chunk of JavaScript. A script tag with type="module"
will signal to the browser that the associated code should be executed as a module, as opposed to execution as a traditional script. Modules can be defined inline or in an external file:
<script type="module">
// module code
</script>
<script type="module" src="path/to/myModule.js"></script>
Even though they are handled in a different way than a conventionally loaded JavaScript file, JavaScript module...