gitlab-org--gitlab-foss/config/helpers/incremental_webpack_compiler/index.js

18 lines
507 B
JavaScript
Raw Normal View History

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);
};