DEV Community

LG
LG

Posted on

Content-Security-Policy (CSP) warning in Electron – how to disable it?

There might be plenty of reasons why we do not want to defined stuff within package.json one one them – flexibility, dedication for yoga ? Hmm maybe , whichever the reason would be let's go remove CSP warning – there least two ways to do so :


Disable through CLI

Consider running Electron's app source file main.js within CLI as so: ELECTRON_DISABLE_SECURITY_WARNINGS=true npx electron main.js

Hereby using npx I did consider you was clever and installed Electron locally beforehand .

Disable through the process

Define anywhere (top-level would be at best) the following

process.env['ELECTRON_DISABLE_SECURITY_WARNINGS']=true
Enter fullscreen mode Exit fullscreen mode

Useful references

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay