summaryrefslogtreecommitdiff
path: root/config/helpers/incremental_webpack_compiler/index.js
blob: 818266074904ccc725f46a60b7c0d1fa4def6e21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
};