본문 바로가기

개발 공부/Three

[Three] Error: Relative references must start with either “/”, “./”, or “../”

문제 발생

처음 three js 를 이용하여 npm i three해서 다운 받아서 아래처럼 import를 하였는데 제목 처럼 해당 오류가 발생하였다.

import * as THREE from "three";

 

문제 해결

index.html에 직접 three 공식 홈페이지에서 모듈을 가져올 수 있게 지정을 해주니깐 제대로 작동하였다.

<script type="importmap">
{
    "imports": {
        "three": "https://threejs.org/build/three.module.js",
    }
}</script>

 

참고자료

 

Error: Relative references must start with either "/", "./", or "../"

Hi, I’m not using CDN as well, I was looking for an answer. Are you using the full package from three.js downloads? if it is, can you show me how are you importing the library into your main.js file?

discourse.threejs.org