For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/plugin-api/context-module-factory-hooks.md.
close

ContextModuleFactory

The ContextModuleFactory module is used by the Compiler to generate dependencies from require.context API. It resolves the requested directory, generates requests for each file and filters against passed regExp. Matching dependencies then passes through NormalModuleFactory.

beforeResolve

AsyncSeriesWaterfallHook<[BeforeResolveResult]>

Called before resolving the requested directory. The request can be ignored by returning false.

afterResolve

AsyncSeriesWaterfallHook<[AfterResolveResult]>

Called after the requested directory resolved.