3

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 type = "module" src = "script.js"> </ script>

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

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?

1
  • 2
    Use a web server? Commented Jul 2, 2018 at 20:17

1 Answer 1

3

You need to serve your page with a Web server. If you didn't have already one configured and are using Google Chrome, you can use the Web Server for Chrome.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.