I'm sorry to ask such a common question... however this has been bugging me for hours! I'm doing all this in a brand new project so it's a clean slate.
I'd like to use the tinycolor JS library in my project. The only things I've done since creating the new project are:
1. Ran "npm install --save tinycolor2 @types/tinycolor2 2. Added "node_modules/@types/tinycolor2/index.d.ts" to the "files" section of tsconfig.json 3. Added "node_modules/tinycolor2/tinycolor.js" to the "externalJS" section of pbiviz.json 4. Added the line console.log(tinycolor("red")); console.log(true); at the top of the visual's update method.
However, this causes the update method to just stop executing after the first line (this was the reason for console.log(true), to pinpoint where it stops executing). Strangely, no error is logged or anything - but something is clearly going wrong to stop the rest of the method executing.
If I change tinycolor("red") to (<any>window).tinycolor("red") then it logs a tinycolor instance, followed by true... as desired.
This isn't expected behaviour, right?
I can get around this by adding let tinycolor = (<any>window).tinycolor; at the top of my visual's module, and then the first example works... but surely there's no way that's the intended method of doing this?
As I said, this is happening on a blank project, so you can copy my steps and see for yourself.
What am I doing wrong? I've followed everything in the guide here.