default to the default hash function

This commit is contained in:
Tobias Koppers 2021-10-28 15:32:06 +02:00
parent 205d3a05ee
commit a6bb3e58ec
3 changed files with 5 additions and 3 deletions

View File

@ -40,7 +40,7 @@ export interface NormalModuleLoaderContext<OptionsType> {
utils: {
absolutify: (context: string, request: string) => string;
contextify: (context: string, request: string) => string;
createHash: (algorithm: string) => Hash;
createHash: (algorithm?: string) => Hash;
};
rootContext: string;
fs: InputFileSystem;

View File

@ -539,7 +539,9 @@ class NormalModule extends Module {
? getContextifyInContext()(request)
: getContextify()(context, request);
},
createHash
createHash: type => {
return createHash(type || compilation.outputOptions.hashFunction);
}
};
const loaderContext = {
version: 2,

2
types.d.ts vendored
View File

@ -7512,7 +7512,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
utils: {
absolutify: (context: string, request: string) => string;
contextify: (context: string, request: string) => string;
createHash: (algorithm: string) => Hash;
createHash: (algorithm?: string) => Hash;
};
rootContext: string;
fs: InputFileSystem;