I’m trying to import plotly from a local file (as both import from node_modules and npm:… failed). Both of the following import the module:
import * as Plotly from "./plotly.min.js"
const Plotly = import(await FileAttachment("plotly.min.js").url())
But in both cases I can access Plotly only from the browser’s inspector (e. g. Plotly.newPlot("plotId")
whereas the same expression fails when included in a source markdown’s JS codeblock:
TypeError: Plotly.newPlot is not a function
What am I missing?