electron-vite/electron-vite-react

[Help] @react-pdf_renderer bug

Denhope opened this issue · 2 comments

Hi! In my App I have bug with @react-pdf_renderer ,
when I generete pdf document
This bug only on Vite? When I use Webpack I didn't have this bug
If some have any Ideas? please help me.

 @react-pdf_renderer.js?v=840c88b4:104898 RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'"). Build with -sASSERTIONS for more info.
at x (@react-pdf_renderer.js?v=840c88b4:11665:16)
at @react-pdf_renderer.js?v=840c88b4:12828:15

/////

@react-pdf_renderer.js?v=840c88b4:11663 Aborted(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate 
WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: 
"script-src 'self' 'unsafe-inline'")

/////
@react-pdf_renderer.js?v=840c88b4:12827 failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Refused 
 to compile or instantiate WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content 
 Security Policy directive: "script-src 'self' 'unsafe-inline'"

Looks like the CSP protection.

Probably you will need to change your index.html and add the CSP meta tag.

Example:

    <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval';">

Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src

Thanks