Cannot load the script with the type “module”


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.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

PHP contact form sending but not receiving emails

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