mirror of https://github.com/webpack/webpack.git
fix: prevent numeric-only content hashes in filename templates
This commit is contained in:
parent
95ce962897
commit
6f3ac96bc1
|
@ -11,6 +11,7 @@ const mime = require("mime-types");
|
||||||
const Chunk = require("./Chunk");
|
const Chunk = require("./Chunk");
|
||||||
const Module = require("./Module");
|
const Module = require("./Module");
|
||||||
const { parseResource } = require("./util/identifier");
|
const { parseResource } = require("./util/identifier");
|
||||||
|
const nonNumericOnlyHash = require("./util/nonNumericOnlyHash");
|
||||||
|
|
||||||
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
||||||
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
||||||
|
@ -63,7 +64,7 @@ const hashLength = (replacer, handler, assetInfo, hashName) => {
|
||||||
} else {
|
} else {
|
||||||
const hash = replacer(match, arg, input);
|
const hash = replacer(match, arg, input);
|
||||||
|
|
||||||
result = length ? hash.slice(0, length) : hash;
|
result = length ? nonNumericOnlyHash(hash, length) : hash;
|
||||||
}
|
}
|
||||||
if (assetInfo) {
|
if (assetInfo) {
|
||||||
assetInfo.immutable = true;
|
assetInfo.immutable = true;
|
||||||
|
|
Loading…
Reference in New Issue