diff --git a/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js b/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js index e7728d0b..f0d8db30 100644 --- a/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js +++ b/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js @@ -17,6 +17,8 @@ const realPath = require('path'); const isAbsolutePath = require('absolute-path'); const getAssetDataFromName = require('../lib/getAssetDataFromName'); +const emptyModule = require.resolve('./assets/empty-module.js'); + class ResolutionRequest { constructor({ platform, @@ -193,7 +195,7 @@ class ResolutionRequest { if (recursive) { // doesn't block the return of this function invocation, but defers - // the resulution of collectionsInProgress.done.then(…) + // the resulution of collectionsInProgress.done.then(...) dependencyModules .forEach(dependency => collectedDependencies.get(dependency)); } @@ -322,7 +324,7 @@ class ResolutionRequest { return this._redirectRequire(fromModule, potentialModulePath).then( realModuleName => { if (realModuleName === false) { - return null; + return this._loadAsFile(emptyModule, fromModule, toModuleName); } return this._tryResolve( @@ -341,7 +343,7 @@ class ResolutionRequest { realModuleName => { // exclude if (realModuleName === false) { - return null; + return this._loadAsFile(emptyModule, fromModule, toModuleName); } if (isRelativeImport(realModuleName) || isAbsolutePath(realModuleName)) { diff --git a/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js b/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js new file mode 100644 index 00000000..e5ed0eb0 --- /dev/null +++ b/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js @@ -0,0 +1,8 @@ + /** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */