<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Static Import</title> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <script src="https://bl.ocks.org/mhofman/raw/fe170f9492196e9eb09907c84ea28999/html-console.js"></script> <script src="https://unpkg.com/iframe-resizer@^4/js/iframeResizer.contentWindow.min.js" defer></script> <script>const log = (msg) => htmlConsole.log(`${document.title}: ${msg}`)</script> <script type="module"> // When using a static import statement, the import has to be manually hoisted // to the top of the current module. // The convention is that the default value of the module is a promise to the API import greeterPromise from './greeter.js'; (async () => { try { const { sayHi } = await greeterPromise; log(sayHi('await greeterPromise')); } catch(e) { log(e.stack); throw e; } })(); </script> </head> <body> <div id="console"></div> </body> </html>