On this page

A virtual module definition.

Type:string

The context for the virtual module. A string path. Defaults to 'auto', which will try to resolve the context from the module id.

virtualModule.source(loaderContext): string | Buffer<ArrayBufferLike> | Promise<string | Buffer<ArrayBufferLike>>
Attributes
loaderContext:LoaderContext<any>
Returns:string | Buffer<ArrayBufferLike> | Promise<string | Buffer<ArrayBufferLike>>

The source function that provides the virtual content.

Type:string

The module type.

Type:string | true | (() => string)

Optional version function or value for cache invalidation.