I ran into an interesting problem today. 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. It was created by ejecting: create-elm-app
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 was wondering if I missed something or did I just find a weird quirk of UglifyJS interacting with Elm.
Here is my webpack config, on line 219 you can see the UglifyJS plugin being commented out.
Perhaps you could try commenting out the options passed to the uglify plugin and see if it works? Then you could enable them again one by one to narrow down the issue. Perhaps one of those “pure_funcs” listed is the issue?
My guess would be something having to do with dead code elimination. I would try disabling that (
I actually tried this before, and I tried again just now. No luck
EDIT: I was wrong. I thought setting
dead_code: false would disable dead code elimination but apparently not.