Using plotly in chrome extension

Does anyone know how to use plotly to plot graphs in chrome extension? I’m trying to build a chrome extension that uses plotly to plot some data but I can’t load it. It throws the error

plotly-latest.min.js:7 Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' blob: filesystem:".

    at new Function (<anonymous>)
    at o (plotly-latest.min.js:7)
    at plotly-latest.min.js:7
    at Object.445.cwise-compiler (plotly-latest.min.js:7)
    at a (plotly-latest.min.js:7)
    at plotly-latest.min.js:7
    at Object.244.ndarray (plotly-latest.min.js:7)
    at a (plotly-latest.min.js:7)
    at plotly-latest.min.js:7
    at Object.258../lib/shaders (plotly-latest.min.js:7)

I have used

        "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" ,

in my manifest.json but it didn’t work. Any help is appreciated

1 Like

Apparently, you can use plotly.js-strict, see plotly.js-strict-dist - npm and this announcement.