Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isFBBundle should be true if it's FB for www or FB for RN #19420

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function getPlugins(
bundleType === UMD_DEV ||
bundleType === UMD_PROD ||
bundleType === UMD_PROFILING;
const isFBBundle =
const isFBWWWBundle =
bundleType === FB_WWW_DEV ||
bundleType === FB_WWW_PROD ||
bundleType === FB_WWW_PROFILING;
Expand All @@ -357,7 +357,7 @@ function getPlugins(
bundleType === RN_FB_DEV ||
bundleType === RN_FB_PROD ||
bundleType === RN_FB_PROFILING;
const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput;
const shouldStayReadable = isFBWWWBundle || isRNBundle || forcePrettyOutput;
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably shouldStayReadable should be false for OSS RN since we don't trust the minifier.

return [
// Extract error codes from invariant() messages into a file.
shouldExtractErrors && {
Expand All @@ -371,7 +371,7 @@ function getPlugins(
// Ensure we don't try to bundle any fbjs modules.
forbidFBJSImports(),
// Replace any externals with their valid internal FB mappings
isFBBundle && replace(Bundles.fbBundleExternalsMap),
isFBWWWBundle && replace(Bundles.fbBundleExternalsMap),
// Use Node resolution mechanism.
resolve({
skip: externals,
Expand Down Expand Up @@ -539,14 +539,19 @@ async function createBundle(bundle, bundleType) {
const format = getFormat(bundleType);
const packageName = Packaging.getPackageName(bundle.entry);

const isFBBundle =
const isFBWWWBundle =
bundleType === FB_WWW_DEV ||
bundleType === FB_WWW_PROD ||
bundleType === FB_WWW_PROFILING;

const isFBRNBundle =
bundleType === RN_FB_DEV ||
bundleType === RN_FB_PROD ||
bundleType === RN_FB_PROFILING;

let resolvedEntry = resolveEntryFork(
require.resolve(bundle.entry),
isFBBundle
isFBWWWBundle || isFBRNBundle
);

const shouldBundleDependencies =
Expand All @@ -559,7 +564,7 @@ async function createBundle(bundle, bundleType) {
const deps = Modules.getDependencies(bundleType, bundle.entry);
externals = externals.concat(deps);
}
if (isFBBundle) {
if (isFBWWWBundle) {
// Add any mapped fb bundle externals
externals = externals.concat(Object.values(Bundles.fbBundleExternalsMap));
}
Expand Down