Total beginner here, followed a tutorial online that used gsap with an NPM install and now I want to push my code up to my website and I am running into some errors.
I have the following html code:
<script type="importmap">
{
"imports": {
"three" : "https://unpkg.com/three@0.126.1/build/three.module.js",
"orbitcontrols" : "https://unpkg.com/three@0.126.1/examples/jsm/controls/OrbitControls.js",
"datgui" : "https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.9/dat.gui.min.js",
"gsap" : "https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"
}
}
</script>
<script type="module" src="{% static 'blog/threeBackground.js' %}"></script>
This is then imported in my .js file as follows:
import * as THREE from 'three';
import { OrbitControls } from 'orbitcontrols';
import * as dat from 'datgui';
import { gsap } from 'gsap';
Upon running my dev server, I get the following error:
Uncaught SyntaxError: The requested module 'gsap' does not provide an export named 'gsap'
I did some googling and found this similar topic, but I still can't seem to figure out what is wrong with my code.
I have tried moving the gsap import out and into its own script tag with a type = "module" tag as it appears was suggested, but that was throwing some errors as well. Any thoughts on how to solve would be much appreciated!
Thanks!