cancel
Showing results for 
Search instead for 
Did you mean: 

Caused by: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an all

0 Kudos
193

hi, I'm used QR code library in SAP my UI5 application.. it's worked for locally & deploy but in SAP Work Zone  i created tile for this application...it is not working ....getting error  like this "Caused by: 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 * data: blob:".  plz anyone help help me.

Accepted Solutions (0)

Answers (1)

Answers (1)

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

This is most probably due to the preload bundle (Component-preload.js or library-preload.js) being generated into string which has to be eval'd at runtime. To avoid that, exclude the third party library from the bundle. See my other answer at Solved: HowTo use 3rd party lib with content-security-policy omitting eval()" - SAP Community.

If the issue still occurs even after excluding the third party lib from the bundle, follow my other Q&A How to Fix "String as JavaScript" Errors in FLP? (Async Module Loading) - Stack Overflow where I have summarized documented best practices for CSP compliance.

0 Kudos
ok, Thank you..