Content Security Policy Error ionic 5 angular core version 8.2.14

Hi! I am getting an error and my app isn’t loading when I run nodemon server.js for port 3000. When I use a chrome extension to disable content security policy everything works perfect. Also testing on devices both IOS and Android both work perfectly. It’s just when I am testing locally that I am getting this error and my app will not load. I searched my code and I don’t see script-src ‘self’ anywhere. I also tried adding a content security policy as a meta tag in my index.html to allow unsafe eval * and the error in the screenshot still pops up. Not sure where to go from here or if I’ll just have to always use that chrome extension to disable content security policy on chrome. Thanks in advance for any help!

In the future, please post textual information as text, not images. Images aren’t searchable, indexable, accessible at all to many people, or particularly persistent.

The key information you need to convey is in that image, which is that you’re using the JIT Angular compiler. I suspect your problem will vanish if you just switch to AOT. More documentation here. Incidentally, make sure you get rid of all the unsafe CSP stuff you did in index.html.

1 Like

Thanks switching to AOT got rid of the error. I also got rid of all unsafe CSP stuff I did in index.html!