Skip to content

🎥 Make videos programmatically with React

warn if @remotion/bundler and @remotion/renderer versions do not align

Jonny Burgerd192d2358cfc
diff --git a/packages/bundler/src/renderEntry.tsx b/packages/bundler/src/renderEntry.tsx
index 17bd174d09..fe803ded9d 100644
--- a/packages/bundler/src/renderEntry.tsx
+++ b/packages/bundler/src/renderEntry.tsx
@@ -223,5 +223,6 @@ if (typeof window !== 'undefined') {
};
window.siteVersion = '4';
+ window.remotion_version = Internals.VERSION;
window.setBundleMode = setBundleModeAndUpdate;
}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index c427e50b10..109796e6cc 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -25,6 +25,7 @@ declare global {
remotion_isBuilding: undefined | (() => void);
remotion_finishedBuilding: undefined | (() => void);
siteVersion: '4';
+ remotion_version: string;
remotion_imported: boolean;
}
}
diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.ts
index 48e3b1d3ff..a04ab4eafc 100644
--- a/packages/renderer/src/set-props-and-env.ts
+++ b/packages/renderer/src/set-props-and-env.ts
@@ -1,3 +1,4 @@
+import {Internals} from 'remotion';
import type {Page} from './browser/BrowserPage';
import {DEFAULT_TIMEOUT} from './browser/TimeoutSettings';
import {normalizeServeUrl} from './normalize-serve-url';
@@ -136,6 +137,15 @@ export const setPropsAndEnv = async ({
page,
});
+ const remotionVersion = await puppeteerEvaluateWithCatch<string>({
+ pageFunction: () => {
+ return window.remotion_version;
+ },
+ args: [],
+ frame: null,
+ page,
+ });
+
const requiredVersion = '4';
if (siteVersion !== requiredVersion) {
@@ -143,4 +153,16 @@ export const setPropsAndEnv = async ({
`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error, please bundle and deploy again.`
);
}
+
+ if (remotionVersion !== Internals.VERSION) {
+ if (remotionVersion) {
+ console.warn(
+ `The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${Internals.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
+ );
+ } else {
+ console.warn(
+ `The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${Internals.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
+ );
+ }
+ }
};