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 14:53:04 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-04-04 14:53:04 +0530
commit5f23f07d04073c06af530332c2d75b48d6c023a0 (patch)
tree2c7359a2b33b95f92f3bba9a9074e6bf9137ac1d /config/webpack/utils/filename-hash.js
parentd178caee5c93ad9ed91dbd082b0f0b5a9b0507aa (diff)
downloadbanglar-bhumi-utils-5f23f07d04073c06af530332c2d75b48d6c023a0.tar.gz
banglar-bhumi-utils-5f23f07d04073c06af530332c2d75b48d6c023a0.zip
Using different global variables for shared modules.
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)}`;
+};