Adding the JavaScript Color Library

Hi there,

I’ve started developing an obsidian plugin and wanted to add the the JavaScript Color Library to my plugin to easily use Color as a Datatype.

I installed the Library through npm:

npm install --save @types/color

I imported the Library to the main.ts through:

import Color from 'color';

I’ve also set the esModuleInterop = true; in the tsconfig.json to allow importing js libraries.

The typescript file compiles without any errors. But ever since I added the library to my code and try to run the plugin I get this error in the log:
app.js:1 Plugin failure: kaleidoscope SyntaxError: Cannot use import statement outside a module (at plugin:kaleidoscope:1:45) at eval (<anonymous>) at app.js:1:1052867 at e.<anonymous> (app.js:1:1052968) at app.js:1:235505 at (app.js:1:235610) at a (app.js:1:234349)
Does anyone know why this error happens and how one might be able to fix it?

A bundler is needed for npm dependencies to work properly. Anyone working on their first plugin should use this template: GitHub - obsidianmd/obsidian-sample-plugin