From 3e7dfdefcdc4f62d76103b74220dabde9bb73f18 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 2 Apr 2021 11:14:55 +0200 Subject: [PATCH] Dereference symlinks and keep original timestamps when copying static dir --- lib/core-server/src/utils/copy-all-static-files.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core-server/src/utils/copy-all-static-files.ts b/lib/core-server/src/utils/copy-all-static-files.ts index f5cd391c25cf..68d9eabe7e7a 100644 --- a/lib/core-server/src/utils/copy-all-static-files.ts +++ b/lib/core-server/src/utils/copy-all-static-files.ts @@ -15,7 +15,11 @@ export async function copyAllStaticFiles(staticDirs: any[] | undefined, outputDi // Storybook's own files should not be overwritten, so we skip such files if we find them const skipPaths = ['index.html', 'iframe.html'].map((f) => path.join(targetPath, f)); - await fs.copy(staticPath, targetPath, { filter: (_, dest) => !skipPaths.includes(dest) }); + await fs.copy(staticPath, targetPath, { + dereference: true, + preserveTimestamps: true, + filter: (_, dest) => !skipPaths.includes(dest), + }); } catch (e) { logger.error(e.message); process.exit(-1);