class 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.
Extended by CssModule.
new NormalModule(__namedParameters): NormalModule
NormalModuleCreateDataNormalModuleObject_1<string>NormalModulebooleanAsyncDependenciesBlock[]BuildInfoBuildMetaDependency[]numberDependency[]Returns the depth. Updates the depth using the provided value.
Source Code: lib/NormalModule.js#L651booleanFactoryMetaGeneratorGeneratorOptionsbooleanReturns the module id assigned by the chunk graph. Updates the module id using the provided value.
Source Code: lib/Module.js#L384Returns the pre-order index. Updates the pre-order index using the provided value.
Source Code: lib/Module.js#L410Returns the post-order index. Updates the post-order index using the provided value.
Source Code: lib/Module.js#L462Returns the issuer. Updates the issuer using the provided value.
Source Code: lib/Module.js#L261LoaderItem[]stringbooleanDependenciesBlockParserParserOptionsDependency[]ModuleProfilestringstringResolveOptionsstringResourceSchemeData & Partial<ResolveRequest>stringanystringbooleanbooleananystringGets exports argument.
anystringReturns the hash of the module.
anystringGets module argument.
(string | ((requestShortener: RequestShortener) => string))[]Gets optimization bailout.
Source Code: lib/Module.js#L512booleanstringReturns the rendered hash of the module.
boolean | SortableSet<string> | nullanynormalModule.addBlock(block): void
AsyncDependenciesBlockAdds a DependencyBlock to DependencyBlock relationship. This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting)
normalModule.addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies): void
Adds the provided file dependencies to the module.
normalModule.addChunk(chunk): boolean
Adds the provided chunk to the module.
normalModule.addCodeGenerationDependency(codeGenerationDependency): void
DependencyAdds code generation dependency.
normalModule.addDependency(dependency): void
DependencyAdds the provided dependency to the dependencies block.
normalModule.addError(error): void
ErrorAdds the provided error to the module.
normalModule.addPresentationalDependency(presentationalDependency): void
DependencyAdds presentational dependency.
normalModule.addWarning(warning): void
ErrorAdds the provided warning to the module.
normalModule.applyNoParseRule(rule, content): boolean
normalModule.build(options, compilation, resolver, fs, callback): void
Builds the module using the provided compilation context.
normalModule.chunkCondition(chunk, compilation): boolean
Returns true if the module can be placed in the chunk.
normalModule.cleanupForCache(): void
Assuming this module is in the cache. Remove internal references to allow freeing some memory.
normalModule.clearDependenciesAndBlocks(): void
Clear dependencies and blocks.
normalModule.clearWarningsAndErrors(): void
removes all warnings and errors
normalModule.codeGeneration(context): CodeGenerationResult
CodeGenerationContextCodeGenerationResultGenerates code and runtime requirements for this module.
normalModule.createSource(context, content, sourceMap?, associatedObjectForCache?): Source
normalModule.createSourceForAsset(context, name, content, sourceMap?, associatedObjectForCache?): Source
normalModule.deserialize(__namedParameters): void
ObjectDeserializerContextObjectMiddlewareObject_4Restores this instance from the provided deserializer context.
normalModule.getChunks(): Chunk[]
Chunk[]normalModule.getConcatenationBailoutReason(context): string | undefined
Returns the reason this module cannot be concatenated, when one exists.
normalModule.getCurrentLoader(loaderContext, index?): LoaderItem | null
normalModule.getErrors(): Error[] | undefined
Returns list of errors if any.
normalModule.getExportsType(moduleGraph, strict?): ExportsType
Returns export type.
normalModule.getNumberOfChunks(): number
numbernormalModule.getNumberOfErrors(): number
numberGets number of errors.
normalModule.getNumberOfWarnings(): number
numberGets number of warnings.
normalModule.getReferencedSourceTypes(): ReadonlySet<string> | undefined
Freshly recomputed source types when they depend on incoming connections, for chunk-graph cache invalidation; undefined otherwise. #20800
normalModule.getResource(): string | null
normalModule.getRootBlock(): DependenciesBlock
DependenciesBlocknormalModule.getSideEffectsConnectionState(moduleGraph): ConnectionState
ModuleGraphConnectionStateGets side effects connection state.
normalModule.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.
normalModule.getSourceTypes(): ReadonlySet<string>
ReadonlySet<string>Returns the source types this module can generate.
normalModule.getUnsafeCacheData(): UnsafeCacheData
UnsafeCacheDataModule should be unsafe cached. Get data that's needed for that. This data will be passed to restoreFromUnsafeCache later.
normalModule.getWarnings(): Error[] | undefined
Returns list of warnings if any.
normalModule.hasChunkCondition(): boolean
booleannormalModule.hasReasonForChunk(chunk, moduleGraph, chunkGraph): boolean
Checks whether this module contains the chunk.
normalModule.hasReasons(moduleGraph, runtime): boolean
Checks whether this module contains the module graph.
normalModule.identifier(): string
stringReturns the unique identifier used to reference this module.
normalModule.invalidateBuild(): void
Invalidates the cached state associated with this value.
normalModule.isAccessibleInChunk(chunkGraph, chunk, ignoreChunk?): boolean
Checks whether this module is accessible in chunk.
normalModule.isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk?): boolean
Checks whether this module is accessible in chunk group.
normalModule.isEntryModule(): boolean
booleannormalModule.isInChunk(chunk): boolean
Checks whether this module is in the provided chunk.
normalModule.isOptional(moduleGraph): boolean
ModuleGraphbooleanChecks whether this module is optional.
normalModule.isProvided(exportName): boolean | null
Checks whether this module provides the specified export.
normalModule.libIdent(options): string | null
LibIdentOptionsGets the library identifier.
normalModule.markModuleAsErrored(error): void
ErrornormalModule.nameForCondition(): string | null
Returns the path used when matching this module against rule conditions.
normalModule.needBuild(context, callback): void
NeedBuildContext(err?: WebpackError | null, needBuild?: boolean) => voidChecks whether the module needs to be rebuilt for the current build state.
normalModule.needRebuild(fileTimestamps, contextTimestamps): boolean
Checks whether it needs rebuild.
normalModule.originalSource(): Source | null
Gets the original source.
normalModule.readableIdentifier(requestShortener): string
RequestShortenerstringReturns a human-readable identifier for this module.
normalModule.removeChunk(chunk): void
ChunkRemoves the provided chunk from the module.
normalModule.removeDependency(dependency): void
DependencyRemoves dependency.
normalModule.restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory): void
UnsafeCacheDataNormalModuleFactoryrestore unsafe cache data
normalModule.serialize(__namedParameters): void
ObjectSerializerContextObjectMiddlewareObject_5Serializes this instance into the provided serializer context.
normalModule.shouldPreventParsing(noParseRule, request): boolean
normalModule.size(type?): number
Returns the estimated size for the requested source type.
normalModule.source(dependencyTemplates, runtimeTemplate, type?): Source
Returns generated source.
normalModule.updateCacheModule(module): void
ModuleAssuming this module is in the cache. Update the (cached) module with the fresh module from the factory. Usually updates internal references and properties.
normalModule.updateHash(hash, context): void
HashUpdateHashContextDependencyUpdates the hash with the data contributed by this instance.
NormalModule.deserialize(context): NormalModule
NormalModuleNormalModule.getCompilationHooks(compilation): { beforeLoaders: SyncHook<[LoaderItem[], NormalModule, AnyLoaderContext]>; beforeParse: SyncHook<[NormalModule]>; beforeSnapshot: SyncHook<[NormalModule]>; loader: SyncHook<[AnyLoaderContext, NormalModule]>; needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>; processResult: SyncWaterfallHook<[[string | Buffer<ArrayBufferLike>, string | RawSourceMap | undefined, PreparsedAst | undefined], NormalModule], [string | Buffer<ArrayBufferLike>, string | RawSourceMap | undefined, PreparsedAst | undefined]>; readResource: HookMap<AsyncSeriesBailHook<[AnyLoaderContext], string | Buffer<ArrayBufferLike> | null, UnsetAdditionalOptions>>; readResourceForScheme: HookMap<FakeHook<AsyncSeriesBailHook<[string, NormalModule], string | Buffer<ArrayBufferLike> | null, UnsetAdditionalOptions>>> }
Compilation{ beforeLoaders: SyncHook<[LoaderItem[], NormalModule, AnyLoaderContext]>; beforeParse: SyncHook<[NormalModule]>; beforeSnapshot: SyncHook<[NormalModule]>; loader: SyncHook<[AnyLoaderContext, NormalModule]>; needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>; processResult: SyncWaterfallHook<[[string | Buffer<ArrayBufferLike>, string | RawSourceMap | undefined, PreparsedAst | undefined], NormalModule], [string | Buffer<ArrayBufferLike>, string | RawSourceMap | undefined, PreparsedAst | undefined]>; readResource: HookMap<AsyncSeriesBailHook<[AnyLoaderContext], string | Buffer<ArrayBufferLike> | null, UnsetAdditionalOptions>>; readResourceForScheme: HookMap<FakeHook<AsyncSeriesBailHook<[string, NormalModule], string | Buffer<ArrayBufferLike> | null, UnsetAdditionalOptions>>> }NormalModule.getSourceBasicTypes(module): ReadonlySet<string>
Gets source basic types.