This simple repo provides a JavaScript modules demo.
The main.js
file is able to import and execute JavaScript from files in the modules
directory.
Try the demo here.
To run locally, download the repo and serve the files using the VS Code extention Live Server by Ritwick Dey, or any other method you prefer.
As of writing, JavaScript modules have 93% global support.
This example also includes a fallback script for browsers that do not support JavaScript modules.