Skip to content

Commit b5e19ad

Browse files
Jean Lauliacfacebook-github-bot
Jean Lauliac
authored andcommittedJan 18, 2018
metro: allow dynamic dependencies from within node_modules
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
1 parent d40db3a commit b5e19ad

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed
 

‎local-cli/bundle/buildBundle.js

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async function buildBundle(
9494
assetExts: defaultAssetExts.concat(assetExts),
9595
assetRegistryPath: ASSET_REGISTRY_PATH,
9696
blacklistRE: config.getBlacklistRE(),
97+
dynamicDepsInPackages: config.dynamicDepsInPackages,
9798
extraNodeModules: config.extraNodeModules,
9899
getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule,
99100
getPolyfills: config.getPolyfills,

‎local-cli/dependencies/dependencies.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function dependencies(argv, config, args, packagerInstance) {
3131
assetRegistryPath: ASSET_REGISTRY_PATH,
3232
projectRoots: config.getProjectRoots(),
3333
blacklistRE: config.getBlacklistRE(),
34+
dynamicDepsInPackages: config.dynamicDepsInPackages,
3435
getPolyfills: config.getPolyfills,
3536
getTransformOptions: config.getTransformOptions,
3637
hasteImpl: config.hasteImpl,

‎local-cli/server/runServer.js

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ function getPackagerServer(args, config, reporter) {
179179
cacheVersion: '3',
180180
enableBabelRCLookup: config.getEnableBabelRCLookup(),
181181
extraNodeModules: config.extraNodeModules,
182+
dynamicDepsInPackages: config.dynamicDepsInPackages,
182183
getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule,
183184
getPolyfills: config.getPolyfills,
184185
getTransformOptions: config.getTransformOptions,

0 commit comments

Comments
 (0)
Please sign in to comment.