From my understanding, Webpack is using under the hood
a default configuration object which is different according to development/production
environment. I am pretty sure about that, since it produces different bundle results
for different environments without us specifying anything in webpack.config.js
. However, I have the following queries:
webpack.config.js
the parts we want to change. Am I right? Is it possible to see these default configuration objects?
Is it possible to totally disable them?
u can set webpack --mode=none
I think the only way to alter them is to override them by adding into our webpack.config.js the parts we want to change. Am I right?
From Webpack medium blog
With the new mode option we tried to reduce the required configuration for a useful build. We tried to cover the common use cases with these defaults.
But from our experience we also know that defaults are not for everyone. Each team has different needs, sometimes because of legacy stuff, sometimes because of personal preferences, sometimes because of special applications or sometimes because they don’t believe common best practices. Many people do want to change defaults to adapt to own use cases. We got you covered. Adding mode doesn’t mean that we remove configuration. Everything is still configurable. We actually made most of the internal optimization steps configurable (you can now disable them).
mode is implemented by setting default values to configuration options. No special behavior is done by mode which isn’t possible via other configuration option.