0

I have an chrome extension that renders a react app in a sidebar (iframe) upon clicking on the extension icon. The react app is being built using webpack (configured with create-react-app with craco)

I'm having the following error while trying to open the extension: 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: "script-src 'self'".

The react app code is inside src dir and the extension code in the public dir.

This is the structure of the repo

And I'm loading the extension from the build directory.

I did try to add devtool: 'cheap-module-source-map' as mentioned in this post to my craco.config.js

and also adding the following csp to my manifest.json

"content_security_policy": {
  "extension_page":"script-src 'self' 'wasm-unsafe-eval'; object-src 'self'"
}

but it did not resolve the issue.

oel2
  • 15
  • 4

0 Answers0