Skip to content

🎥 Make videos programmatically with React

allow to exclude bundler

Jonny Burgerc7fff219b835
diff --git a/packages/lambda/src/shared/bundle-site.ts b/packages/lambda/src/shared/bundle-site.ts
index c9a0d71ac2..3df4775f43 100644
--- a/packages/lambda/src/shared/bundle-site.ts
+++ b/packages/lambda/src/shared/bundle-site.ts
@@ -1,3 +1,11 @@
-import {bundle} from '@remotion/bundler';
+import type {bundle} from '@remotion/bundler';
-export const bundleSite = bundle;
+// don't import @remotion/bundle at top so the bundler module can
+// be omitted if you are using esbuild to bundle.
+// eventually we could make a lambda-client that only exports browser-supported functions
+
+// or we export it as an ECMAscript module and allow a treeshake.
+export const bundleSite: typeof bundle = async (...args) => {
+ const bundler = require('@remotion/bundler').bundle as typeof bundle;
+ return bundler(...args);
+};