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?

Put an import map like this, before any other scripts are loaded in your html:

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

You can replace those paths ^ with your cdn paths or wherever you want to pull threejs from… The formatting is picky… so don’t leave trailing , on the last entry or anything… it can be hard to tell if it generates an error.

Then in your code, import things like this:


import*as THREE from 'three'
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'

1 Like

you use like this, and make sure all import path of all addons is fixed to relative path