diff options
Diffstat (limited to 'config/helpers/incremental_webpack_compiler/index.js')
-rw-r--r-- | config/helpers/incremental_webpack_compiler/index.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/config/helpers/incremental_webpack_compiler/index.js b/config/helpers/incremental_webpack_compiler/index.js new file mode 100644 index 00000000000..81826607490 --- /dev/null +++ b/config/helpers/incremental_webpack_compiler/index.js @@ -0,0 +1,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); +}; |