Skip to content

🎥 Make videos programmatically with React

handle symlinks

Jonny Burger90851313f8ca
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index dcf2464439..cfd29b8986 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -181,7 +181,7 @@ export async function bundle(...args: Arguments): Promise<string> {
: path.join(resolvedRemotionRoot, 'public');
const to = path.join(outDir, 'public');
if (fs.existsSync(from)) {
- await copyDir(from, to);
+ await copyDir({src: from, dest: to});
}
const html = indexHtml({
diff --git a/packages/bundler/src/copy-dir.ts b/packages/bundler/src/copy-dir.ts
index 23f8f537d4..375aea472e 100644
--- a/packages/bundler/src/copy-dir.ts
+++ b/packages/bundler/src/copy-dir.ts
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
-export async function copyDir(src: string, dest: string) {
+export async function copyDir({src, dest}: {src: string; dest: string}) {
await fs.promises.mkdir(dest, {recursive: true});
const entries = await fs.promises.readdir(src, {withFileTypes: true});
@@ -10,7 +10,10 @@ export async function copyDir(src: string, dest: string) {
const destPath = path.join(dest, entry.name);
if (entry.isDirectory()) {
- await copyDir(srcPath, destPath);
+ await copyDir({src: srcPath, dest: destPath});
+ } else if (entry.isSymbolicLink()) {
+ const realpath = await fs.promises.realpath(srcPath);
+ await fs.promises.symlink(realpath, destPath);
} else {
await fs.promises.copyFile(srcPath, destPath);
}