diff --git a/code/core/src/core-server/utils/copy-all-static-files.ts b/code/core/src/core-server/utils/copy-all-static-files.ts index e00c08b8c166..e75ae0af0a8e 100644 --- a/code/core/src/core-server/utils/copy-all-static-files.ts +++ b/code/core/src/core-server/utils/copy-all-static-files.ts @@ -24,7 +24,7 @@ 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) => join(targetPath, f)); + const skipPaths = ['index.html', 'iframe.html'].map((f) => join(outputDir, f)); await cp(staticPath, targetPath, { dereference: true, preserveTimestamps: true, @@ -62,7 +62,7 @@ export async function copyAllStaticFilesRelativeToMain( ); const targetPath = join(outputDir, to); - const skipPaths = ['index.html', 'iframe.html'].map((f) => join(targetPath, f)); + const skipPaths = ['index.html', 'iframe.html'].map((f) => join(outputDir, f)); if (!from.includes('node_modules')) { logger.info( `=> Copying static files: ${picocolors.cyan(print(from))} at ${picocolors.cyan(print(targetPath))}`