Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building app with electron:pack - resulting app shows blank page and error in console #211

Open
tommykjensen opened this issue Oct 1, 2022 · 1 comment

Comments

@tommykjensen
Copy link

I have created a project with ionic start, template sidemenu.

Then I added electron following the get started steps.
npm i @capacitor-community/electron
npx cap add @capacitor-community/electron

When running the app with the npx cap open command the starts and the app works.

If I then build a mac application with the command electron:pack and execute the resulting file then the app start but with a blank page.

In the console log following error is displayed:

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: "default-src capacitor-electron://* 'unsafe-inline' data:".

Platform: Mac Studio M1, Monterey 12.4

ps if I use the git repository "angular-electron" by Maxine Griss and build the app it works. But in that case I have big troubles adding the Ionic framework :-( I really would like to use Ionic in a electron app.

@JuliusSkrisa
Copy link

@tommykjensen go to steup.ts in electron/src and add 'unsafe-eval' to 'Content-Security-Policy' string.
"default-src capacitor-electron://* 'unsafe-inline' data: 'unsafe-eval' "

if you dont want to use unsafe-eval, check this up: https://content-security-policy.com/examples/electron/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants