Cannot load the script with the type “module”

Multi tool use
Multi tool use


Cannot load the script with the type “module”



In the file script.js there are features of ES6 like import. For this, I connect script.js as a module, without the type = 'module' the browser generates an error. But when I connect the script


script.js


ES6


import


script.js


module


type = 'module'


<script type = "module" src = "script.js"> </ script>



as a module, in the Chrome browser (v67), the console pops up an error:


module


Chrome browser (v67)



Access to Script at 'file: /// D: /PROJECT/playing_field/src/script.js'
from origin 'null' has been blocked by CORS policy: Invalid response.
Origin 'null' is therefore not allowed access.



how to connect a script as a module?





Use a web server?
– estus
Jul 2 at 20:17









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

AoeiDCrUf,grjH,kWVvGb5lFCc3cTb7LJTV,YiiInwiWPAnwX kzwBAxk1bm5i1YPxG0cFAsBtZwVhVFTkGMHWyYISW,48FtPmhYVbOk
fPdumId8zeBA

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications