How to run WebAssembly.compile(a.code) on frontend?

I’ve been trying to compile a wasm code on the frontend javascript but this error has been bugging me for hours now:

Uncaught (in promise) CompileError: WebAssembly.compile(): 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'"
    at p (index-d10505ae.js:69:52328)
    at 2../src/bn128.js (index-d10505ae.js:53:92638)

I’ve added meta tag such as <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval';"> but i still got it.

You can adapt CSP headers by modifying the .ic-assets.json5 file(s) in your project. In a project generated by dfx new you should find an example, otherwise we also have some (but not much) documentation here. Maybe the docs chatbot is more helpful in this case.

Also, if the new headers don’t get applied try reinstalling your asset canister. IIRC there is still a problem with headers not properly updating