Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upUglifyJS breaking HTTP request? Stripping "Authorization" header #243
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
halfzebra
Mar 20, 2018
Owner
@praveenperera Thanks for reporting the issue!
The bug was caused by dead code elimination, which is disabled by default since v1.9.0
You can grab the latest config from webpack.config.prod.js if you want to upgrade.
Alternatively you can replace the configuration with:
/* Minify the compiled JavaScript. */
new UglifyJsPlugin({
compress: {
warnings: false,
},
output: {
comments: false,
},
}), To get the JavaScript minification back for your project.
I hope this helps! I'm closing this issue, but please feel free to reopen it
|
@praveenperera Thanks for reporting the issue! The bug was caused by dead code elimination, which is disabled by default since v1.9.0 You can grab the latest config from webpack.config.prod.js if you want to upgrade. Alternatively you can replace the configuration with: /* Minify the compiled JavaScript. */
new UglifyJsPlugin({
compress: {
warnings: false,
},
output: {
comments: false,
},
}), To get the JavaScript minification back for your project. I hope this helps! I'm closing this issue, but please feel free to reopen it |
halfzebra
closed this
Mar 20, 2018
halfzebra
added
the
fix
label
Mar 20, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
praveenperera
Mar 20, 2018
@halfzebra ahh thanks! I thought I was disabling the dead_code elimination by setting dead_code: false. But removing the pure_funcs as above worked! Thanks
praveenperera
commented
Mar 20, 2018
•
|
@halfzebra ahh thanks! I thought I was disabling the dead_code elimination by setting |
praveenperera commentedMar 20, 2018
•
edited
Edited 4 times
-
praveenperera
edited Mar 20, 2018 (most recent)
-
praveenperera
edited Mar 20, 2018
-
praveenperera
edited Mar 20, 2018
-
praveenperera
edited Mar 20, 2018
Is this a bug report?
MAYBE
Environment
node -v: v8.9.4npm -v: 5.6.0yarn --version(if you use Yarn): 1.5.1npm ls create-elm-app -g(if you haven’t ejected):I said maybe because this seems like a really weird bug that only I've experienced, but I thought I would create an issue in case anyone else runs across the same thing.
I ran into an interesting problem yesterday. On my dev environment authentication was working fine. However on production the “Authorization” header was not being sent. After hours of debug CORS and other related things, I decided to check out my webpack config.
From there I disabled the UglifyJS plugin and everything worked as expected. I doubled checked, enabling UglifyJS broke the HTTP request. I then undid all the other changes I made attempting to debug, and tried again. As far as I can tell, UglifyJS was the issue. I don’t know if this is relevant but I am using HttpBuilder to builder request.
I also tried enabling Uglify but setting dead_code to false. It still breaks it.
I don't know if this is a right place to post this, but I spent a lot of hours debugging this. I'm hoping opening this issue helps save someone else time if they run into the same or similar issue.
This was created by ejecting create-elm-app around May 21, 2017
Here is my webpack config, on line 219 you can see the UglifyJS plugin being commented out.
https://gist.github.com/praveenperera/f048f21eef1daef98a4c8f6cb834d2af