Want to grow up the front-end rookie to ask for help, in the html file to refer to the use of "ES6's module" js file error.

when I was trying to learn the module of es6, Baidu found that it was necessary to set the type of script to module in order to introduce js files, but after Google ran, I reported a similar cross-domain problem. I was confused, and Baidu didn"t find the reason. Thank you very much! Friends!

here is my picture

(code in the bar.js file)

test.htmlbar.js


Apr.06,2022

first you have to afford a local server.


do not open it directly in the file, you can build a local server, use node,tomcat,apache, directly open in the file will report an error.

Menu