From 3cdd2edad1fa995022c76ef4081dfd22f11e7ee8 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Tue, 14 May 2019 14:31:15 +0300 Subject: [PATCH] fix: fallback for cache directory (#86) --- src/TaskRunner.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TaskRunner.js b/src/TaskRunner.js index 82e6664e..2c625b6b 100644 --- a/src/TaskRunner.js +++ b/src/TaskRunner.js @@ -13,7 +13,9 @@ export default class TaskRunner { constructor(options = {}) { const { cache, parallel } = options; this.cacheDir = - cache === true ? findCacheDir({ name: 'terser-webpack-plugin' }) : cache; + cache === true + ? findCacheDir({ name: 'terser-webpack-plugin' }) || os.tmpdir() + : cache; // In some cases cpus() returns undefined // https://github.com/nodejs/node/issues/19022 const cpus = os.cpus() || { length: 1 };