Skip to content

🎥 Make videos programmatically with React

Keep React Refresh out of production bundles

JonnyBurgercd41e4ae0202
diff --git a/packages/bundler/src/setup-sequence-stack-traces.ts b/packages/bundler/src/setup-sequence-stack-traces.ts
index 5286a1d730..b11658b954 100644
--- a/packages/bundler/src/setup-sequence-stack-traces.ts
+++ b/packages/bundler/src/setup-sequence-stack-traces.ts
@@ -7,12 +7,6 @@ type ReactRefreshRuntime = {
getFamilyByType: (component: unknown) => unknown;
};
-const RefreshRuntime = require('react-refresh/runtime') as ReactRefreshRuntime;
-
-Internals.setComponentIdentityResolver((component) => {
- return RefreshRuntime.getFamilyByType(component) ?? component;
-});
-
const componentsToAddStacksTo = Internals.getComponentsToAddStacksTo();
const sequenceComponent = Internals.getSequenceComponent();
const internalStackProp = Internals.REMOTION_INTERNAL_STACK_PROP;
@@ -117,5 +111,10 @@ if (typeof window !== 'undefined') {
}
if (process.env.NODE_ENV !== 'production') {
+ const RefreshRuntime =
+ require('react-refresh/runtime') as ReactRefreshRuntime;
+ Internals.setComponentIdentityResolver((component) => {
+ return RefreshRuntime.getFamilyByType(component) ?? component;
+ });
enableSequenceStackTraces();
}