Module resolution

Module resolution takes place via the use of a resolver. A resolver assists you in locating a module by its absolute path—the path to a module that is universally used throughout a project.

Note that a module can act as a dependency of another module, such as the following:

import example from 'path/to/module';

Regardless of whether the dependency module is from another library (not the resolver itself) or the application itself, the resolver will help to find the module code required to include in the bundle. Webpack 5 can also use enhance-resolve to resolve paths while bundling.

The resolving rules for Webpack 5 mean that, using the enhanced-resolve method, Webpack 5 can resolve three kinds of file paths:

  • Absolute paths
  • Relative paths
  • Module paths

The following sections will detail the meaning of each file path and there will be an example for each. This will become important later as we begin to build on our project bundle.

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

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