TheNormalModuleFactory module is used by theCompiler to generate modules. Starting with entry points, it resolves each request, parses the content to find further requests, and keeps crawling through files by resolving all and parsing any new files. At last stage, each dependency becomes a Module instance.
TheNormalModuleFactory class extendsTapable and provides the followinglifecycle hooks. They can be tapped the same way as compiler hooks:
NormalModuleFactory.hooks.someHook.tap(/* ... */);NormaleModuleFactory createsParser andGenerator instances which can be accessed by HookMaps. Identifier must be passed to tap into these:
NormalModuleFactory.hooks.someHook.for('identifier').tap(/* ... */);As with thecompiler,tapAsync andtapPromise may also be availabledepending on the type of hook.
AsyncSeriesBailHook
Called when a new dependency request is encountered. A dependency can be ignored by returningfalse. Otherwise, it should returnundefined to proceed.
resolveDataAsyncSeriesBailHook
Called before initiating resolve. It should returnundefined to proceed.
resolveDataAsyncSeriesBailHook
Called before the request is resolved. A dependency can be ignored by returningfalse. Returning a Module instance would finalize the process. Otherwise, it should returnundefined to proceed.
resolveDataAsyncSeriesBailHook
Called before a request with scheme (URI) is resolved.
resolveDataAsyncSeriesBailHook
Called after the request is resolved.
resolveDataAsyncSeriesBailHook
Called before aNormalModule instance is created.
createDataresolveDataHookMap<SyncBailHook>
A hook that allows you to override theNormalModule class when creating modules. This hook is called after thecreateModule hook and before themodule hook.
Hook Parameters:identifier
Callback Parameters:createDataresolveData
SyncWaterfallHook
Called after aNormalModule instance is created.
modulecreateDataresolveDataHookMap<SyncBailHook>
Called before aParser instance is created.parserOptions is options inmodule.parser for the corresponding identifier or an empty object.
Hook Parameters:identifier
Callback Parameters:parserOptions
HookMap<SyncHook>
Fired after aParser instance is created.
Hook Parameters:identifier
Callback Parameters:parserparserOptions
Possible default identifiers:
javascript/autojavascript/dynamicjavascript/esmjsonwebassembly/syncwebassembly/asyncassetHookMap<SyncBailHook>
Called before aGenerator instance is created.generatorOptions is options inmodule.parser for the corresponding identifier or an empty object.
Hook Parameters:identifier
Callback Parameters:generatorOptions
HookMap<SyncHook>
Called after aGenerator instance is created.
Hook Parameters:identifier
Callback Parameters:generatorgeneratorOptions
Possible default identifiers:
jsonwebassembly/syncwebassembly/asyncassetasset/sourceasset/resourceasset/inlineasset/bytes