es-modules-utils

Native ECMAScript modules utilities

Installation

Usage

no-module-fallback

Provides ability to use native ECMAScript modules (aka ES or ES6 modules, with native import/export) or the bundled JavaScript file if they are not supported.

The utility script is expected to be included in HTML, e.g.:

<script
            module="./module.js"
            no-module="./no-module.js"
            
            add-global-class
            add-global-variable
            
            src="es-modules-utils/no-module-fallback.js"
    >
    </script>

Params:

The solution uses the nomodule script attribute approach, which also can be used without the additional features like:

<script type="module" src="module-URL.js"></script>
<script nomodule src="no-module-URL.js"></script>

Demo