From 5f23f07d04073c06af530332c2d75b48d6c023a0 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:53:04 +0530 Subject: Using different global variables for shared modules. --- config/webpack/utils/filename-hash.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 config/webpack/utils/filename-hash.js (limited to 'config/webpack/utils/filename-hash.js') 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)}`; +}; -- cgit v1.2.3