aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/filename-hash.js
blob: bd66647cf250c57039f2fea18334383fff5a4655 (plain)
1
2
3
4
5
6
7
8
9
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)}`;
};