I am in need of incorporating a colormap into my JavaScript page. My server side is powered by Flask, written in Python. To render colormaps on the client side, I have a JavaScript file that requires the colormap module (installed using "npm install colormap"). In an attempt to import it from my JavaScript file index.js
var colormap = import("colormap");
I encountered the following error:
index.js:2 Uncaught (in promise) TypeError: Failed to resolve module specifier 'colormap'
at index.js:2
I also experimented with:
let colormap = require('colormap')
However, I received an error stating that require is not defined.
How can this issue be resolved? My goal is to directly import the JavaScript file containing the colormap into my HTML for proper referencing, but I am unsure which file I should be importing.