htmlファイルをChromeで開くとコンソールに以下のようなエラーが表示されます。どうしたら解決できるでしょうか?
Access to script at 'file:///Users/○○○/Desktop/dev/threeJs-Project/threeJs-Udemy-4/main.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
HMLのソースコードを提示してください。
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ThreeJs-Udemy</title>
</head>
<body>
<script src="main.js" type="module"></script>
</body>
</html>
main.js
import * as THREE from "./build/three.module.js";
const scene = new THREE.Scene();
console.log(scene);
このようになっています。three.jsを使おうとしているのですが、うまくいきません。
質問本文は修正できるので、そのソースコードを、質問本文に記載お願いします。

回答1件
あなたの回答
tips
プレビュー