Webpack 默认配置对象

Webpack default configuration object

根据我的理解,Webpack 使用 under the hood 一个 default 配置对象,根据 development/production 环境。我对此很确定,因为它会为不同的环境生成 different bundle results,而无需我们在 webpack.config.js 中指定任何内容。但是,我有以下疑问:

是否可以看到这些默认配置对象?

Default Options here

是否可以完全禁用它们?

你可以设置webpack --mode=none

More Info on mode here

我认为改变它们的唯一方法是通过在我们的 webpack.config.js 中添加我们想要改变的部分来覆盖它们。我说的对吗?

来自 Webpack 媒体博客

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.

Link to blog