✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🏦 Standard & Poor's chooses Dash Enterprise for ESG analysis. Learn why, sign up for the June 23 Webinar here!

Correct way to load plotly.js within nw.js

I’ll preface this by warning I am both a js and plotly beginner so apologies if this is obvious but my search so far has been fruitless.

As per the title I am attempting to require(“plotly.js-dist”) from a typescript source inside of nw.js. I can create a new scatter plot with newPlot but the styling seems to be off (bad layout, no hover effects, no mouse dragging). If I load plotly with a script tag from my index.html everything seems to work fine, however this does not seem to be the Node.js way and it also seems wrong to be putting a hard-coded path to a file in an npm package.

I have a feeling that ‘required’ plotly cannot find the elements, as newPlot(‘myDiv’… does not work whereas newPlot(document.getElementById(‘myDiv’)… does bring up a plot.

I am currently using:
npm package plotly.js-dist@2.0.0
nw.js version 0.54.0