const isProd = true; // Change here to test differents environments
function applyHashIfNecessary(strings, shouldOptimize) {
const all = String.raw(strings).split('.'); // Transform into array
const name = all.shift(); // Get first, assume this is a name
if (isProd) { // Apply hash on begginer
all.unshift('[hash]');
}
return [ name, ...all ].join('.'); // Concat all with . divider
}
applyHashIfNecessary`[name].test.js`;