Если открывать через "Live Server" в VSCode то все работает,а если открывать просто index.html ,то в консоли выдает ошибку.Как использовать модули,что бы не получать CORS ?
Access to script at 'file:///D:/js/gallery.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" href="/css/style.css" />
</head>
<body>
<ul class="gallery js-gallery"></ul>
<div class="lightbox js-lightbox">
<div class="lightbox__overlay"></div>
<div class="lightbox__content">
<img class="lightbox__image" src="" alt="" />
</div>
<button
type="button"
class="lightbox__button"
data-action="close-lightbox"
></button>
</div>
<script src="/js/gallery.js" type="module"></script>
</body>
</html>