Skip to content

Commit ab1f517

Browse files
authored
isFBBundle should be true if it's FB for www or FB for RN (facebook#19420)
This ensures that the .fb.js override files kick in for RN. Otherwise we won't have FB specific exports in the isomorphic modules.
1 parent ecbdb74 commit ab1f517

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

scripts/rollup/build.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function getPlugins(
346346
bundleType === UMD_DEV ||
347347
bundleType === UMD_PROD ||
348348
bundleType === UMD_PROFILING;
349-
const isFBBundle =
349+
const isFBWWWBundle =
350350
bundleType === FB_WWW_DEV ||
351351
bundleType === FB_WWW_PROD ||
352352
bundleType === FB_WWW_PROFILING;
@@ -357,7 +357,7 @@ function getPlugins(
357357
bundleType === RN_FB_DEV ||
358358
bundleType === RN_FB_PROD ||
359359
bundleType === RN_FB_PROFILING;
360-
const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput;
360+
const shouldStayReadable = isFBWWWBundle || isRNBundle || forcePrettyOutput;
361361
return [
362362
// Extract error codes from invariant() messages into a file.
363363
shouldExtractErrors && {
@@ -371,7 +371,7 @@ function getPlugins(
371371
// Ensure we don't try to bundle any fbjs modules.
372372
forbidFBJSImports(),
373373
// Replace any externals with their valid internal FB mappings
374-
isFBBundle && replace(Bundles.fbBundleExternalsMap),
374+
isFBWWWBundle && replace(Bundles.fbBundleExternalsMap),
375375
// Use Node resolution mechanism.
376376
resolve({
377377
skip: externals,
@@ -539,14 +539,19 @@ async function createBundle(bundle, bundleType) {
539539
const format = getFormat(bundleType);
540540
const packageName = Packaging.getPackageName(bundle.entry);
541541

542-
const isFBBundle =
542+
const isFBWWWBundle =
543543
bundleType === FB_WWW_DEV ||
544544
bundleType === FB_WWW_PROD ||
545545
bundleType === FB_WWW_PROFILING;
546546

547+
const isFBRNBundle =
548+
bundleType === RN_FB_DEV ||
549+
bundleType === RN_FB_PROD ||
550+
bundleType === RN_FB_PROFILING;
551+
547552
let resolvedEntry = resolveEntryFork(
548553
require.resolve(bundle.entry),
549-
isFBBundle
554+
isFBWWWBundle || isFBRNBundle
550555
);
551556

552557
const shouldBundleDependencies =
@@ -559,7 +564,7 @@ async function createBundle(bundle, bundleType) {
559564
const deps = Modules.getDependencies(bundleType, bundle.entry);
560565
externals = externals.concat(deps);
561566
}
562-
if (isFBBundle) {
567+
if (isFBWWWBundle) {
563568
// Add any mapped fb bundle externals
564569
externals = externals.concat(Object.values(Bundles.fbBundleExternalsMap));
565570
}

0 commit comments

Comments
 (0)