On this page

Defines the define plugin hooks type used by this module.

new DefinePlugin(definitions): DefinePlugin
Attributes
definitions:Definitions
A map of global object definitions
Returns:DefinePlugin

Create a new define plugin

Attributes
definitions:Definitions
getCompilationHooks:(compilation: Compilation) => DefinePluginHooks
getMergedDefinitionNode:(compilation: Compilation, key: string) => MergedDefinitionNode
Returns the merged definition node for a definition key.
getRuntimeRequirements:(code: string) => string[] | undefined
Runtime requirements of replacement code referencing the require function.
stringifyMergedDefinition:(compilation: Compilation, parser: JavascriptParser, node: MergedDefinitionNode, key: string, objKeys?: Set<string> | null) => string
Renders a merged definition node to raw code (object literal for map nodes).
toPropertyKey:(key: string) => string
Object literal key code; __proto__ must be computed to stay an own property.
VALUE_DEP_MAIN:"webpack/DefinePlugin_hash"
VALUE_DEP_PREFIX:"webpack/DefinePlugin "
apply(compiler): void
Attributes
compiler:Compiler
the compiler instance
Returns:void

Applies the plugin by registering its hooks on the compiler.


Attributes
fn:(value: { key: string; module: NormalModule; version: ValueCacheVersion }) => CodeValuePrimitive
generator function
options:true | string[] | RuntimeValueOptions
options
Returns:RuntimeValue
runtime value

Returns runtime value.


Attributes
definitions:SyncWaterfallHook<[Record<string, CodeValue>], Record<string, CodeValue>>



Type:{ [index: string]: RecursiveArrayOrRecord<T> } | RecursiveArrayOrRecord<T>[] | T