forked from ppfun/pixelplanet
HF
6d3b6edd8a
write custom webpack loader to invalidate language specific files choose most recent asset based on mtime rather than birthtime
21 lines
454 B
JavaScript
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;
|
|
}
|