pixelplanet/scripts/TtagNonCacheableLoader.js
HF 6d3b6edd8a cache all language builds in the same folder
write custom webpack loader to invalidate language specific files
choose most recent asset based on mtime rather than birthtime
2023-12-12 17:58:06 +01:00

21 lines
454 B
JavaScript

/*
* webpack loader that
* marks modules that include ttag as non-cachable
*/
const filtered = {};
module.exports = function (source) {
if (filtered.hasOwnProperty(this.resourcePath)) {
if (filtered[this.resourcePath]) {
this.cacheable(false);
}
return source;
}
const hasTtag = source.slice(0, 400).includes('ttag');
filtered[this.resourcePath] = hasTtag;
if (hasTtag) {
this.cacheable(false);
}
return source;
}