Skip to content

Commit 9544c3e

Browse files
fix: use official hash* options for hashes (#1619)
1 parent 06587e5 commit 9544c3e

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/utils.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,6 @@ function getModulesOptions(rawOptions, esModule, exportType, loaderContext) {
519519
({ auto } = rawModulesOptions);
520520
}
521521

522-
// eslint-disable-next-line no-underscore-dangle
523-
const { outputOptions } = loaderContext._compilation;
524522
const needNamedExport =
525523
exportType === "css-style-sheet" || exportType === "string";
526524
const namedExport =
@@ -539,10 +537,27 @@ function getModulesOptions(rawOptions, esModule, exportType, loaderContext) {
539537
exportGlobals: false,
540538
localIdentName: "[hash:base64]",
541539
localIdentContext: loaderContext.rootContext,
542-
localIdentHashSalt: outputOptions.hashSalt,
543-
localIdentHashFunction: outputOptions.hashFunction,
544-
localIdentHashDigest: outputOptions.hashDigest,
545-
localIdentHashDigestLength: outputOptions.hashDigestLength,
540+
// eslint-disable-next-line no-underscore-dangle
541+
localIdentHashSalt:
542+
loaderContext.hashSalt ||
543+
// TODO remove in the next major release
544+
// eslint-disable-next-line no-underscore-dangle
545+
loaderContext._compilation.outputOptions.hashSalt,
546+
localIdentHashFunction:
547+
loaderContext.hashFunction ||
548+
// TODO remove in the next major release
549+
// eslint-disable-next-line no-underscore-dangle
550+
loaderContext._compilation.outputOptions.hashFunction,
551+
localIdentHashDigest:
552+
loaderContext.hashDigest ||
553+
// TODO remove in the next major release
554+
// eslint-disable-next-line no-underscore-dangle
555+
loaderContext._compilation.outputOptions.hashDigest,
556+
localIdentHashDigestLength:
557+
loaderContext.hashDigestLength ||
558+
// TODO remove in the next major release
559+
// eslint-disable-next-line no-underscore-dangle
560+
loaderContext._compilation.outputOptions.hashDigestLength,
546561
// eslint-disable-next-line no-undefined
547562
localIdentRegExp: undefined,
548563
// eslint-disable-next-line no-undefined

0 commit comments

Comments
 (0)