module configuration determines how different types of modules within a project are treated. This includes configuring loaders, parser options, and generator settings.
Basic Configuration
webpack.config.js
Module Options
An array of rules that are matched to requests when modules are created.
Prevent parsing of matched files. Useful for large libraries.
Parser options by module type.
Generator options by module type.
Rule Configuration
Each rule can have the following properties:Matching Conditions
Matching Conditions
Match files by their resource path.
Include only these files/directories.
Exclude these files/directories.
Match the resource path.
Match the resource query string.
Match the module that imports this module.
Match by dependency type.
Loader Configuration
Loader Configuration
Module Type and Processing
Module Type and Processing
Set the module type.Types:
'javascript/auto', 'javascript/esm', 'javascript/dynamic', 'json', 'webassembly/async', 'webassembly/sync', 'asset', 'asset/source', 'asset/resource', 'asset/inline', 'css', 'css/module'Parser options for this rule.
Generator options for this rule.
Rule Organization
Rule Organization
Advanced Options
Advanced Options