diff --git a/scripts/rollup/shims/rollup/ReactFeatureFlags-www.js b/scripts/rollup/shims/rollup/ReactFeatureFlags-www.js index 90b1cad885..e4e93f0f2b 100644 --- a/scripts/rollup/shims/rollup/ReactFeatureFlags-www.js +++ b/scripts/rollup/shims/rollup/ReactFeatureFlags-www.js @@ -10,18 +10,27 @@ import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; import typeof * as FeatureFlagsShimType from './ReactFeatureFlags-www'; -// Re-export all flags from the www version. +// Re-export dynamic flags from the www version. export const { - enableAsyncSubtreeAPI, enableAsyncSchedulingByDefaultInReactDOM, - enableReactFragment, - enableCreateRoot, - // Reconciler flags - enableMutatingReconciler, - enableNoopReconciler, - enablePersistentReconciler, } = require('ReactFeatureFlags'); +// The rest of the flags are static for better dead code elimination. +export const enableAsyncSubtreeAPI = true; +export const enableReactFragment = false; +export const enableCreateRoot = false; + +// The www bundles only use the mutating reconciler. +export const enableMutatingReconciler = true; +export const enableNoopReconciler = false; +export const enablePersistentReconciler = false; + +// In www, we have experimental support for gathering data +// from User Timing API calls in production. By default, we +// only emit performance.mark/measure calls in __DEV__. But if +// somebody calls addUserTimingListener() which is exposed as an +// experimental FB-only export, we call performance.mark/measure +// as long as there is more than a single listener. export let enableUserTimingAPI = __DEV__; let refCount = 0; @@ -38,6 +47,9 @@ export function addUserTimingListener() { }; } +// The flag is intentionally updated in a timeout. +// We don't support toggling it during reconciliation or +// commit since that would cause mismatching user timing API calls. let timeout = null; function updateFlagOutsideOfReactCallStack() { if (!timeout) {