Answer the question
In order to leave comments, you need to log in
ES6 modules locally. Or how to bypass CORS?
Hello.
There is an application using ES6 modules, everything is OK on the server, but without the server writes
Access to Script at 'file:///C:/Users/nameuser/Desktop/project/controller.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.
js connects like this,
how to get around this CORS on local?
ps install the server / upload to hosting, etc. not an option:)
Answer the question
In order to leave comments, you need to log in
This is the security rule of the browser
itself in which you are trying to receive data, using the file:// protocol the easiest way, and practice getting and requesting data using the http:// protocol
I haven’t tried it, but perhaps some browser extensions will help (like this one ) By the
way, I myself encountered a similar problem and the IDE itself helped me. I use WebStorm, when opening pages through the IDE itself, it opens pages in localhost, I didn’t delve into the essence, but apparently the IDE itself creates something like a local server (without nodejs, on its own, so to speak). The only caveat, to work with imports in the settings, you need to enable https://monosnap.com/file/RvlDRly1x2GfEWkeVXBOqFmk... otherwise, when opening or updating the page, the IDE will ask for permission for each imported resource, which is very inconvenient
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question