some_file.js
console.log("!")
function hello(){
console.log("Hello!")
}
index.html
<script src="some_file.js" type="module"></script>
<script>
hello()
</script>
When hosting and looking at index.html
, I recieve a ReferenceError
telling me that hello
is not found. Following the advice to this thread other similar ones, I've placed something like window.hello = hello
in my javascript file to no avail. I've also attempted exporting the function (which I think I'd only need to do if I were importing it in another javascript file).
Why am I getting a ReferenceError
? The script is certainly being loaded, because I see the !
print out in the console, but the function isn't being found.