-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CSP headers cannot be set with webpack-dev-server v4 #3040
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
Comments
Please create reproducible test repo |
@alexander-akait Here is reproducible, sorry for the delay: https://github.com/bedrich-schindler/webpack-dev-server-reproducible-3040 |
@bedrich-schindler Here two problems, we need reduce our client to avoid unnecessary code #3062 (will be merged today) Also we have Anyway to solve the problem you can do right now:
I known it is not best solution and we should avoid using Thanks for the issue |
Feel free to feedback |
Operating System: MacOS Big Sur 11.2.1
Node Version: v14.15.5
NPM Version: 6.14.11
webpack Version: 5.22.0
webpack-dev-server Version: 4.0.0-beta.0
html-webpack-plugin: 5.0.0
csp-html-webpack-plugin Version: 5.1.0
This is a bug
This is a modification request
Code
Expected Behavior
Before update of webpack-dev-server from 3.11.2 to 4.0.0-beta.0, everything had worked fine with no errors in console.
Actual Behavior
After update to 4.0.0-beta.0, console contains two errors of the following type
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 'self' data: 'unsafe-inline'".
In my opinion, It has something to do with Hot Replacement Module because it had not been happening before I updated webpack-dev-server . As you can see, there are errors in stack trace that are pointing
Object.hot
andObject.liveReload
.If I set
hot: false, liveReload: true
then error containingObject.hot
disappears, if I sethot: true, liveReload: false
then error containingObject.liveReload
disappears.Unfortunately, If I set both to false, new errors are shown:
It looks like that something changed in webpack-dev-server that disallowing us to work with CSP headers. I might not be problem is CSP plugin because those headers are set in
devServer
option.The text was updated successfully, but these errors were encountered: