I have a php file index.php:
<html>
...
</html>
<script type="module">
function example() {
...
}
</script>
When trying to run example() in the chrome console I am met with:
Uncaught ReferenceError: example is not defined
at <anonymous>:1:1
(anonymous) @ VM234:1
If I remove type="module" from my script tag this function is executed as expected.
Is there any way to run a function when it is defined with module type?