Skip to content

Commit

Permalink
metro: allow dynamic dependencies from within node_modules
Browse files Browse the repository at this point in the history
Summary: Tries to adress facebook/metro#65. We need a reasonnable workaround to support modules like `moment.js` that do dynamic requires but only in some cases. By replacing the call by a function that throws, we move the exception at runtime instead of happening at compile time. We don't want to do that for non-node_modules file because they are fixable directly, while `node_modules` are not fixable by people and they get completely blocked by the error at compile time.

Reviewed By: rafeca

Differential Revision: D6736989

fbshipit-source-id: a6e1fd9b56fa83907400884efd8f8594018b7c37
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Jan 18, 2018
1 parent d40db3a commit b5e19ad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ async function buildBundle(
assetExts: defaultAssetExts.concat(assetExts),
assetRegistryPath: ASSET_REGISTRY_PATH,
blacklistRE: config.getBlacklistRE(),
dynamicDepsInPackages: config.dynamicDepsInPackages,
extraNodeModules: config.extraNodeModules,
getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule,
getPolyfills: config.getPolyfills,
Expand Down
1 change: 1 addition & 0 deletions local-cli/dependencies/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function dependencies(argv, config, args, packagerInstance) {
assetRegistryPath: ASSET_REGISTRY_PATH,
projectRoots: config.getProjectRoots(),
blacklistRE: config.getBlacklistRE(),
dynamicDepsInPackages: config.dynamicDepsInPackages,
getPolyfills: config.getPolyfills,
getTransformOptions: config.getTransformOptions,
hasteImpl: config.hasteImpl,
Expand Down
1 change: 1 addition & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function getPackagerServer(args, config, reporter) {
cacheVersion: '3',
enableBabelRCLookup: config.getEnableBabelRCLookup(),
extraNodeModules: config.extraNodeModules,
dynamicDepsInPackages: config.dynamicDepsInPackages,
getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule,
getPolyfills: config.getPolyfills,
getTransformOptions: config.getTransformOptions,
Expand Down

0 comments on commit b5e19ad

Please sign in to comment.