Using different configuration files

Webpack 5 gives the option of using different configuration files, depending on the situation. Not only that, but the files being used can be altered using a command-line utility. A typical situation in which you might do that is when working with multiple bundles inside one project—more on that topic later on in the guide. The following code snippet shows how the developer can alter the configuration file in use. In this example, a file is directed to a named package.json file, which is a common file that Webpack uses regularly. This technique is referred to as a config flag:

"scripts": {
  "build": "webpack --config example.config.js" }

Please note that Webpack 5 also allows for custom configuration, and, as explained in Chapter 1Introduction to Webpack 5, this is a salient advantage of using Webpack 5. This is done via the use of custom configuration files. This differs from options, as these variables are not set using the command-line interface (CLI).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.246.203