diff --git a/packager/src/lib/GlobalTransformCache.js b/packager/src/lib/GlobalTransformCache.js index 79a169ed2..31d27cef2 100644 --- a/packager/src/lib/GlobalTransformCache.js +++ b/packager/src/lib/GlobalTransformCache.js @@ -247,14 +247,15 @@ class GlobalTransformCache { }); } + shouldFetch(props: FetchProps): boolean { + return this._profileSet.has(props.transformOptions); + } + /** * This may return `null` if either the cache doesn't have a value for that * key yet, or an error happened, processed separately. */ async fetch(props: FetchProps): Promise { - if (!this._profileSet.has(props.transformOptions)) { - return null; - } const uri = await this._fetcher.fetch(GlobalTransformCache.keyOf(props)); if (uri == null) { return null; diff --git a/packager/src/node-haste/Module.js b/packager/src/node-haste/Module.js index 0f1892ca5..5b89683ec 100644 --- a/packager/src/node-haste/Module.js +++ b/packager/src/node-haste/Module.js @@ -303,7 +303,7 @@ class Module { callback: (error: ?Error, result: ?TransformedCode) => void, ) { const {_globalCache} = this; - if (_globalCache == null) { + if (_globalCache == null || !_globalCache.shouldFetch(cacheProps)) { this._transformCodeForCallback(cacheProps, callback); return; }