aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/filename-hash.js
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-04-04 18:47:07 +0530
committerGitHub <noreply@github.com>2023-04-04 18:47:07 +0530
commit6bc8d472a556774630e4432141d5ef9f8ea68c59 (patch)
treece84736dce9c14b06f1adbda867aa6a357a4bbab /config/webpack/utils/filename-hash.js
parentd178caee5c93ad9ed91dbd082b0f0b5a9b0507aa (diff)
parent35413607c62f2de2a90941d487b7964b5c213999 (diff)
downloadbanglar-bhumi-utils-6bc8d472a556774630e4432141d5ef9f8ea68c59.tar.gz
banglar-bhumi-utils-6bc8d472a556774630e4432141d5ef9f8ea68c59.zip
Merge pull request #1 from arpitchakladar/shared-modules
Merging shared modules improvements.
Diffstat (limited to 'config/webpack/utils/filename-hash.js')
-rw-r--r--config/webpack/utils/filename-hash.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/config/webpack/utils/filename-hash.js b/config/webpack/utils/filename-hash.js
new file mode 100644
index 0000000..bd66647
--- /dev/null
+++ b/config/webpack/utils/filename-hash.js
@@ -0,0 +1,10 @@
+const crypto = require("crypto");
+
+module.exports.getFileNameHash = (fileName, prefix) => {
+ const hash = crypto
+ .createHash("md5")
+ .update(`${prefix}-${fileName}`)
+ .digest("hex");
+
+ return production ? hash : `${fileName}-${hash.substring(16)}`;
+};