diff --git a/lib/TemplatedPathPlugin.js b/lib/TemplatedPathPlugin.js index 0afb5aff2..187254ed6 100644 --- a/lib/TemplatedPathPlugin.js +++ b/lib/TemplatedPathPlugin.js @@ -11,6 +11,7 @@ const mime = require("mime-types"); const Chunk = require("./Chunk"); const Module = require("./Module"); const { parseResource } = require("./util/identifier"); +const nonNumericOnlyHash = require("./util/nonNumericOnlyHash"); /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./ChunkGraph").ModuleId} ModuleId */ @@ -63,7 +64,7 @@ const hashLength = (replacer, handler, assetInfo, hashName) => { } else { const hash = replacer(match, arg, input); - result = length ? hash.slice(0, length) : hash; + result = length ? nonNumericOnlyHash(hash, length) : hash; } if (assetInfo) { assetInfo.immutable = true;