🎥 Make videos programmatically with React
don't render anything if it's just index.html
Jonny Burgere5724240c85c
diff --git a/packages/bundler/src/renderEntry.tsx b/packages/bundler/src/renderEntry.tsxindex 431d94f8f8..eccecc4c9a 100644--- a/packages/bundler/src/renderEntry.tsx+++ b/packages/bundler/src/renderEntry.tsx@@ -96,10 +96,12 @@ const GetVideo = () => {);};-render(- <Internals.RemotionRoot>- <Root />- <GetVideo />- </Internals.RemotionRoot>,- document.getElementById('container')-);+if (!Internals.isPlainIndex()) {+ render(+ <Internals.RemotionRoot>+ <Root />+ <GetVideo />+ </Internals.RemotionRoot>,+ document.getElementById('container')+ );+}diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.tsindex 996d635a05..a8d2bda418 100644--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@ -49,7 +49,12 @@ import {import {FEATURE_FLAG_FIREFOX_SUPPORT} from './feature-flags';import {isAudioCodec} from './is-audio-codec';import * as perf from './perf';-import {getCompositionName, getIsEvaluation, getRoot} from './register-root';+import {+ getCompositionName,+ getIsEvaluation,+ getRoot,+ isPlainIndex,+} from './register-root';import {RemotionRoot} from './RemotionRoot';import {SequenceContext} from './sequencing';import * as Timeline from './timeline-position-state';@@ -106,6 +111,7 @@ export const Internals = {SequenceContext,useRemotionContexts,RemotionContextProvider,+ isPlainIndex,};export type {diff --git a/packages/core/src/register-root.tsx b/packages/core/src/register-root.tsxindex 4556147124..92ed9e9e47 100644--- a/packages/core/src/register-root.tsx+++ b/packages/core/src/register-root.tsx@@ -28,6 +28,12 @@ export const removeStaticComposition = (id: string) => {});};+// Is a plain index.html file with neither ?evalution nor ?composition URL.+// Useful for just setting localStorage values.+export const isPlainIndex = () => {+ return !getIsEvaluation() && getCompositionName() === null;+};+export const getCompositionName = () => {const param = new URLSearchParams(window.location.search).get('composition');if (param !== null) {