I tried to import ColorThief into my code but I get an error saying
Uncaught SyntaxError: Cannot use import statement outside a module
I don't know what to do since I just copied the import statement on the ColorThief website, and I downloaded the node-module thing so the path is correct.
In addition I found out that the import statement causes another error. It causes my setBio function to be "declared but never read" but I used it in my HTML file like this:
<button onClick=setBio()>Search</button>
The error disappears and everything works (all the features I implemented before trying to implement a color thief feature) once I comment out the import statement.
Here's a condensed version of what's in my JS file:
import ColorThief from './node_modules/colorthief/dist/color-thief.mjs'
let setBio = async () =>
{
let input = document.getElementById("input");
let pokemon = input.value.toLowerCase();
input.value = ""
let display = document.getElementById("name");
display.innerHTML = await getName(pokemon);
let pic = document.getElementById("img");
pic.src = await getPic(pokemon);
setBGColor();
}
Any help would be appreciated. I am new so I apologize if it's something stupid