Using RequireJS to load plotly and D3

前端 未结 3 1216
傲寒
傲寒 2021-01-21 07:22

I am trying to use RequireJS to load the plotly and d3 libraries in my js code. I have tried this:

require.config({
    paths: {
       d3: \'/static/scripts/plo         


        
3条回答
  •  难免孤独
    2021-01-21 07:47

    I had the same problem, it's a defect/oversight in Plotly. The error occurs on the last line of the library itself (plotly.js / plotly.min.js):

    ...:414}]},{},[305])(305)});Plotly.version='1.0.0';
    

    I suspect this is a problem with the module pattern being used and the library's own code to detect AMD loaders.

    I was able to workaround it removing the last line, which I'd guess doesn't cause any break in functionality.

    ...:414}]},{},[305])(305)});
    

提交回复
热议问题