question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Refused to evaluate a string as JavaScript because 'unsafe-eval'

See original GitHub issue

monaco-editor version: 0.24.0 Browser: Chrome/Firefox OS: Playground code that reproduces the issue:

  • Enable CSP policy without having 'unsafe-eval' enabled.
  • Load the editor
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...

at eval (<anonymous>)
    at workerMain.js:2
    at editor.main.js:2

If you need more details about it please let me know.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dstrengecommented, Sep 10, 2021

Why not always use importScripts?

0reactions
alexdimacommented, Dec 1, 2021

@bhoomij The initial issue is resolved. If you get a CSP error, please create a new issue with complete repro steps. You can also test using the nightly builds e.g. monaco-editor@0.31.0-dev.20211201.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome extension compiled by Webpack throws `unsafe-eval ...
How can I permit the use of eval() in my code (because Webpack uses this to generate source maps)?. javascript · google-chrome ·...
Read more >
Refused to evaluate a string as JavaScript because ... - GitHub
Description: When loading the library, the browser throws an error: Uncaught EvalError: Refused to evaluate a string as JavaScript because ' ...
Read more >
ERROR EvalError: Refused to evaluate a string as JavaScript ...
To work around, we need to turn on the 'unsafe-eval' option - but that is basically disabling the Content Security Policy, so not...
Read more >
Chrome: script-src eval: Refused to evaluate a string as ...
There are 2 solutions how to fix the "refused to evaluate a string as JavaScript" eval error, less safe and more safe. Before...
Read more >
[Reports Only] ,Refused to evaluate a string as Javascript ...
Hi Tableau,. I am experiencing error on : [Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found