After the migration of our main app was completed and Datadog was set up on our frontend, we started receiving a lot of errors, warnings, and debug messages on our DD dashboard. At some point, our CTO asked why we were using Dev mode in our production environment.

Dev mode enabled on production

When we were asked why Dev mode was enabled on production, to be honest, I was not aware of this behavior. What I heard from the team was that they needed it that way to allow debugging their local environments, which didn’t make too much sense when talking about production. After our conversation, I was put in charge of fixing the issue, and what I found was that, by default, it was set to development mode and all the builds were using the same configuration.

Webpack default config

This was a fairly easy fix. The solution was creating a different script for production, passing the production mode as an argument to the webpack command:

Webpack production command

This type of misconfiguration might not seem like it can impact the performance of a website, as we tend to think it is only an ugly message in the console. However, it actually impacts performance, as the build mode changes how the files are compiled. Production mode produces optimized and minified files, and the loading speed of the page is increased.

Here is a comparison before and after the changes were applied.

Developer Mode metrics

Production mode Metrics