On this page

These properties are added by the NormalModule

Type:string
Type:number
Type:string
Type:"development" | "none" | "production"
Type:string
Type:boolean
Type:Object
normalModuleLoaderContext.utils.absolutify(context, request): string
Attributes
context:string
request:string
Returns:string
normalModuleLoaderContext.utils.contextify(context, request): string
Attributes
context:string
request:string
Returns:string
normalModuleLoaderContext.utils.createHash(algorithm?): Hash
Attributes
algorithm:string | typeof Hash
Returns:Hash
Type:number
Type:boolean
normalModuleLoaderContext.addBuildDependency(dep): void
Attributes
dep:string
normalModuleLoaderContext.emitError(error): void
Attributes
error:string | Error

Emits an error for this module. The error will be displayed to the user and typically causes the compilation to fail.

normalModuleLoaderContext.emitFile(name, content, sourceMap?, assetInfo?): void
Attributes
name:string
content:string | Buffer<ArrayBufferLike>
sourceMap:string
assetInfo:AssetInfo

Emits a new file (asset) to the compilation output directory. This allows loaders to generate additional files alongside the main module output.

normalModuleLoaderContext.emitWarning(warning): void
Attributes
warning:string | Error

Emits a warning for this module. The warning will be displayed to the user during compilation.

normalModuleLoaderContext.getLogger(name?): WebpackLogger
Attributes
name:string

Gets a logger instance scoped to this loader and module. Useful for emitting debug or compilation information in a structured way.

normalModuleLoaderContext.getOptions(): OptionsType
Returns:OptionsType

Extracts and parses the options of the current loader. Parses string options as JSON or a query string.

normalModuleLoaderContext.getOptions(schema): OptionsType
Attributes
schema:Schema
Returns:OptionsType

Extracts and parses the options of the current loader. Parses string options as JSON or a query string, and optionally validates them against a provided schema.

normalModuleLoaderContext.getResolve(options?): { (context: string, request: string, callback: (err: ErrorWithDetail | null, res?: string | false, req?: ResolveRequest) => void): void; (context: string, request: string): Promise<string> }
Attributes
Returns:{ (context: string, request: string, callback: (err: ErrorWithDetail | null, res?: string | false, req?: ResolveRequest) => void): void; (context: string, request: string): Promise<string> }

Creates a resolve function with specific options. The returned function can be used as a Promise-based resolver or a callback-based resolver.

normalModuleLoaderContext.resolve(context, request, callback): void
Attributes
context:string
request:string
callback:(err: ErrorWithDetail | null, res?: string | false, req?: ResolveRequest) => void

Resolves a module request (e.g., a relative path or module name) to an absolute file path. It uses Webpack's internal resolver, taking into account configured aliases and extensions.