'I cannot import three.js correctly

I wanted to share the work of my first explorations with three.js with a co-worker. Locally everything looked correct, but when I tried to upload my project to GH Pages I got this error constantly:

Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".

I tried updating the import links in my script.js file, but I can't seem to fix it. This is how I currently have the links.

import * as THREE from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js'
import { OrbitControls } from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js'
import * as dat from 'dat.gui'

and I got the same error but applied to 'dat.gui'.

Uncaught TypeError: Failed to resolve module specifier "dat.gui". Relative references must start with either "/", "./", or "../".

Here is the repository

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source