From 3c1cf9f6886a3f84932674052fce8ab7d5122ff9 Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Esun Date: Thu, 26 Apr 2018 12:04:03 -0700 Subject: [PATCH] Enforce by default a local FileStore cache Reviewed By: davidaurelio Differential Revision: D7774249 fbshipit-source-id: ec00cfc4982fa1077a9b6e9cd2be419f59323595 --- packages/metro/src/Config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/metro/src/Config.js b/packages/metro/src/Config.js index 38252add..b86ca877 100644 --- a/packages/metro/src/Config.js +++ b/packages/metro/src/Config.js @@ -10,9 +10,11 @@ 'use strict'; const blacklist = require('./blacklist'); +const os = require('os'); const path = require('path'); const {providesModuleNodeModules} = require('./defaults'); +const {FileStore} = require('metro-cache'); import type { GetTransformOptions, @@ -178,7 +180,11 @@ const DEFAULT = ({ enhanceMiddleware: middleware => middleware, extraNodeModules: {}, assetTransforms: false, - cacheStores: [], + cacheStores: [ + new FileStore({ + root: path.join(os.tmpdir(), 'metro-cache'), + }), + ], cacheVersion: '1.0', dynamicDepsInPackages: 'throwAtRuntime', getAsyncRequireModulePath: () => 'metro/src/lib/bundle-modules/asyncRequire',