tobua/webpack-react-pdf

Getting error in production build

sktanwar2014 opened this issue · 2 comments

i created build and run it with node expressJs framework, it throwing below error...
can you please make expressJs server to run it's build.
let me know once it has been completed

Error
main.js:2 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'".

at new Function (<anonymous>)
at new t (main.js:2)
at Module.1080 (main.js:2)
at __webpack_require__ (main.js:2)
at Object.1384 (main.js:2)
at __webpack_require__ (main.js:2)
at main.js:2
at main.js:2
at main.js:2
tobua commented

Hey @sktanwar2014 check out my response here diegomura/react-pdf#1336 (comment)

Looks like you're missing the Content Security Policy header. Had this issue before, but with the current demo on github the header is not required. Probably before I loaded the polyfills from an external source or didn't have HTTPS.

tobua commented

Here you find an example of how to serve the static files (main.js) with express and adding a middleware to set the CSP header.