- I noticed that when adding
type="module"to a script tag in HTML withsrc="./someJS.js", variables from this JS file are not accessible from the browser console and appear asundefined. This differs from the same HTML tag without themoduleindication, where all variables can be perfectly viewed from the browser.
I would like to ask for a detailed explanation regarding this behavior.
- Additionally, I would like to ask if using
type="module"is mandatory when using animportstatement within the JS file I am loading into the HTML or if there is any way to get around this.
Thank you very much!