In my Blazor app I'm using Plotly.Blazor for showing some graphs.
I have recently added BlazorMonaco, but once added - Plotly.Blazor stopped working.
In the DevTools console I get the following error:
Error: Microsoft.JSInterop.JSException: Cannot read properties of
undefined (reading 'newPlot') TypeError: Cannot read properties of
undefined (reading 'newPlot')
at Module.newPlot (https://localhost:5001/_content/Plotly.Blazor/plotly-interop.js:4:19)
at https://localhost:5001/_framework/blazor.server.js:1:3244
...
After exploring a bit:
- If I don't reference
Monaco's_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.jsfile,Plotlyworks just fine (but than of course Monaco wont work). - When debugging
Plotly'sjs it seems thatwindow.Plotlyis not defined.
My conclusion is that Monaco is probably polluting the global namespace, but I cannot find hard evidence for that...
Any suggestions how I can work around this issue?
Additional information:
- BlazorMonaco: Version
3.2.0 - Plotly.Blazor: Version
4.3.0