debian-mirror-gitlab/config/helpers/incremental_webpack_compiler/index.js

18 lines
507 B
JavaScript
Raw Normal View History

2021-11-11 11:23:49 +05:30
const { NoopCompiler, HistoryOnlyCompiler, IncrementalWebpackCompiler } = require('./compiler');
const log = require('./log');
module.exports = (recordHistory, enabled, historyFilePath, ttl) => {
if (!recordHistory) {
log(`Status disabled`);
return new NoopCompiler();
}
if (enabled) {
log(`Status enabled, ttl=${ttl}`);
return new IncrementalWebpackCompiler(historyFilePath, ttl);
}
log(`Status history-only`);
return new HistoryOnlyCompiler(historyFilePath);
};