aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/file-name-hash.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/utils/file-name-hash.js')
-rw-r--r--config/webpack/utils/file-name-hash.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/config/webpack/utils/file-name-hash.js b/config/webpack/utils/file-name-hash.js
index e3988a9..889e9a4 100644
--- a/config/webpack/utils/file-name-hash.js
+++ b/config/webpack/utils/file-name-hash.js
@@ -1,3 +1,11 @@
const crypto = require("crypto");
-module.exports.getFileNameHash = fileName => crypto.createHash("md5").update(fileName).digest("hex").substring(16);
+module.exports.getFileNameHash = (fileName, prefix) => {
+ const finalFileName = `${prefix}-${fileName}`;
+ const hash = crypto
+ .createHash("md5")
+ .update(finalFileName)
+ .digest("hex");
+
+ return production ? hash : `${fileName}-${hash.substring(16)}`;
+};