class webpack.NormalModule extends Module
DependenciesBlock is the base class for all Module classes in webpack. It describes a "block" of dependencies which are pointers to other DependenciesBlock instances. For example when a Module has a CommonJs require statement, the DependencyBlock for the CommonJs module would be added as a dependency to the Module. DependenciesBlock is inherited by two types of classes: Module subclasses and AsyncDependenciesBlock subclasses. The only difference between the two is that AsyncDependenciesBlock subclasses are used for code-splitting (async boundary) and Module subclasses are not.
new NormalModule(normalModuleCreateDataNormalModuleObject_1): NormalModule
NormalModuleCreateDataNormalModuleObject_1<string>NormalModulebooleanAsyncDependenciesBlock[]BuildInfoBuildMetaDependency[]numberDependency[]anystringbooleanFactoryMetaGeneratorGeneratorOptionsanystringbooleananyLoaderItem[]stringstringboolean(string | ((requestShortener: RequestShortener) => string))[]booleanDependenciesBlockParserParserOptionsDependency[]ModuleProfilestringstringstringResolveOptionsstringResourceSchemeData & Partial<ResolveRequest>stringanyboolean | SortableSet<string> | nullstringbooleanbooleananyaddBlock(block): void
AsyncDependenciesBlockvoidAdds a DependencyBlock to DependencyBlock relationship. This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting)
addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies): void
voidAdds the provided file dependencies to the module.
addChunk(chunk): boolean
Adds the provided chunk to the module.
addCodeGenerationDependency(codeGenerationDependency): void
DependencyvoidAdds code generation dependency.
addDependency(dependency): void
DependencyvoidAdds the provided dependency to the dependencies block.
addError(error): void
Adds the provided error to the module.
addPresentationalDependency(presentationalDependency): void
DependencyvoidAdds presentational dependency.
addWarning(warning): void
Adds the provided warning to the module.
applyNoParseRule(rule, content): boolean
build(options, compilation, resolver, fs, callback): void
CompilationResolverWithOptions(err?: WebpackError) => voidvoidBuilds the module using the provided compilation context.
chunkCondition(chunk, compilation): boolean
Returns true if the module can be placed in the chunk.
cleanupForCache(): void
voidAssuming this module is in the cache. Remove internal references to allow freeing some memory.
clearDependenciesAndBlocks(): void
voidClear dependencies and blocks.
clearWarningsAndErrors(): void
voidremoves all warnings and errors
codeGeneration(context): CodeGenerationResult
CodeGenerationContextCodeGenerationResultGenerates code and runtime requirements for this module.
createSource(context, content, sourceMap?, associatedObjectForCache?): Source
createSourceForAsset(context, name, content, sourceMap?, associatedObjectForCache?): Source
deserialize(objectDeserializerContextObjectMiddlewareObject_4): void
ObjectDeserializerContextObjectMiddlewareObject_4voidRestores this instance from the provided deserializer context.
getChunks(): Chunk[]
Chunk[]getConcatenationBailoutReason(context): string | undefined
Returns the reason this module cannot be concatenated, when one exists.
getCurrentLoader(loaderContext, index?): LoaderItem | null
getErrors(): Error[] | undefined
Returns list of errors if any.
getExportsType(moduleGraph, strict?): ExportsType
Returns export type.
getNumberOfChunks(): number
numbergetNumberOfErrors(): number
numberGets number of errors.
getNumberOfWarnings(): number
numberGets number of warnings.
getReferencedSourceTypes(): ReadonlySet<string> | undefined
Freshly recomputed source types when they depend on incoming connections, for chunk-graph cache invalidation; undefined otherwise. #20800
getResource(): string | null
getRootBlock(): DependenciesBlock
DependenciesBlockgetSideEffectsConnectionState(moduleGraph): ConnectionState
ModuleGraphConnectionStateGets side effects connection state.
getSourceBasicTypes(): ReadonlySet<string>
ReadonlySet<string>Basic source types are high-level categories like javascript, css, webassembly, etc. We only have built-in knowledge about the javascript basic type here; other basic types may be added or changed over time by generators and do not need to be handled or detected here. Some modules, e.g. RemoteModule, may return non-basic source types like "remote" and "share-init" from getSourceTypes(), but their generated output is still JavaScript, i.e. their basic type is JS.
getSourceTypes(): ReadonlySet<string>
ReadonlySet<string>Returns the source types this module can generate.
getUnsafeCacheData(): UnsafeCacheData
UnsafeCacheDataModule should be unsafe cached. Get data that's needed for that. This data will be passed to restoreFromUnsafeCache later.
getWarnings(): Error[] | undefined
Returns list of warnings if any.
hasChunkCondition(): boolean
booleanhasReasonForChunk(chunk, moduleGraph, chunkGraph): boolean
Checks whether this module contains the chunk.
hasReasons(moduleGraph, runtime): boolean
Checks whether this module contains the module graph.
identifier(): string
stringReturns the unique identifier used to reference this module.
invalidateBuild(): void
voidInvalidates the cached state associated with this value.
isAccessibleInChunk(chunkGraph, chunk, ignoreChunk?): boolean
Checks whether this module is accessible in chunk.
isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk?): boolean
Checks whether this module is accessible in chunk group.
isEntryModule(): boolean
booleanisInChunk(chunk): boolean
Checks whether this module is in the provided chunk.
isOptional(moduleGraph): boolean
ModuleGraphbooleanChecks whether this module is optional.
isProvided(exportName): boolean | null
Checks whether this module provides the specified export.
libIdent(options): string | null
LibIdentOptionsGets the library identifier.
markModuleAsErrored(error): void
nameForCondition(): string | null
Returns the path used when matching this module against rule conditions.
needBuild(context, callback): void
NeedBuildContext(err?: WebpackError | null, needBuild?: boolean) => voidvoidChecks whether the module needs to be rebuilt for the current build state.
needRebuild(fileTimestamps, contextTimestamps): boolean
Checks whether it needs rebuild.
originalSource(): Source | null
Gets the original source.
readableIdentifier(requestShortener): string
RequestShortenerstringReturns a human-readable identifier for this module.
removeChunk(chunk): void
Removes the provided chunk from the module.
removeDependency(dependency): void
DependencyvoidRemoves dependency.
restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory): void
UnsafeCacheDataNormalModuleFactoryvoidrestore unsafe cache data
serialize(objectSerializerContextObjectMiddlewareObject_5): void
ObjectSerializerContextObjectMiddlewareObject_5voidSerializes this instance into the provided serializer context.
shouldPreventParsing(noParseRule, request): boolean
string | RegExp | ((content: string) => boolean) | (string | RegExp | ((content: string) => boolean))[] | undefinedstringbooleansize
size(type?): number
Returns the estimated size for the requested source type.
source(dependencyTemplates, runtimeTemplate, type?): Source
Returns generated source.
updateCacheModule(module): void
Assuming this module is in the cache. Update the (cached) module with the fresh module from the factory. Usually updates internal references and properties.
updateHash(hash, context): void
Updates the hash with the data contributed by this instance.
NormalModuleRestores this instance from the provided deserializer context.
CompilationNormalModuleCompilationHooksGets source basic types.