isFBBundle should be true if it's FB for www or FB for RN (#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.
Sebastian Markbåge committed
Jul 20, 2020 at 13:37 UTC
ab1f51700056667e5a2b97d5df7f118fea9868ac
1 file changed
+11
-6
scripts/rollup/build.js
+11
-6
@@ -346,7 +346,7 @@ function getPlugins(
346
bundleType === UMD_DEV ||
347
bundleType === UMD_PROD ||
348
bundleType === UMD_PROFILING;
349
- const isFBBundle =
349
+ const isFBWWWBundle =
350
bundleType === FB_WWW_DEV ||
351
bundleType === FB_WWW_PROD ||
352
bundleType === FB_WWW_PROFILING;
@@ -357,7 +357,7 @@ function getPlugins(
357
bundleType === RN_FB_DEV ||
358
bundleType === RN_FB_PROD ||
359
bundleType === RN_FB_PROFILING;
360
- const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput;
360
+ const shouldStayReadable = isFBWWWBundle || isRNBundle || forcePrettyOutput;
361
return [
362
// Extract error codes from invariant() messages into a file.
363
shouldExtractErrors && {
@@ -371,7 +371,7 @@ function getPlugins(
371
// Ensure we don't try to bundle any fbjs modules.
372
forbidFBJSImports(),
373
// Replace any externals with their valid internal FB mappings
374
- isFBBundle && replace(Bundles.fbBundleExternalsMap),
374
+ isFBWWWBundle && replace(Bundles.fbBundleExternalsMap),
375
// Use Node resolution mechanism.
376
resolve({
377
skip: externals,
@@ -539,14 +539,19 @@ async function createBundle(bundle, bundleType) {
539
const format = getFormat(bundleType);
540
const packageName = Packaging.getPackageName(bundle.entry);
541
542
- const isFBBundle =
542
+ const isFBWWWBundle =
543
bundleType === FB_WWW_DEV ||
544
bundleType === FB_WWW_PROD ||
545
bundleType === FB_WWW_PROFILING;
546
547
+ const isFBRNBundle =
548
+ bundleType === RN_FB_DEV ||
549
+ bundleType === RN_FB_PROD ||
550
+ bundleType === RN_FB_PROFILING;
551
+
552
let resolvedEntry = resolveEntryFork(
553
require.resolve(bundle.entry),
549
- isFBBundle
554
+ isFBWWWBundle || isFBRNBundle
555
);
556
557
const shouldBundleDependencies =
@@ -559,7 +564,7 @@ async function createBundle(bundle, bundleType) {
564
const deps = Modules.getDependencies(bundleType, bundle.entry);
565
externals = externals.concat(deps);
566
}
562
- if (isFBBundle) {
567
+ if (isFBWWWBundle) {
568
// Add any mapped fb bundle externals
569
externals = externals.concat(Object.values(Bundles.fbBundleExternalsMap));
570
}