The JavaScript exception "import declarations may only appear at top level of a module" occurs when an import declaration is not at the top level of a module. This might be because the import declaration is nested in other constructs (functions, blocks, etc.), or more often because the current file is not treated as a module....loaded from HTML, make sure the <script> tag has the type="module"...a non-module script If you are loading the script from HTML, make...