From cd8587d5bd868e67d9c1db387fa741644ea492f2 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 9 Apr 2024 12:18:53 +0200 Subject: [PATCH] cli: copy public files to both protected and public dist dirs Signed-off-by: Patrik Oldsberg --- packages/cli/src/lib/bundler/bundle.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/lib/bundler/bundle.ts b/packages/cli/src/lib/bundler/bundle.ts index e9b20aea3c..b9b826c247 100644 --- a/packages/cli/src/lib/bundler/bundle.ts +++ b/packages/cli/src/lib/bundler/bundle.ts @@ -82,15 +82,18 @@ export async function buildBundle(options: BuildOptions) { await fs.emptyDir(paths.targetDist); if (paths.targetPublic) { - await fs.copy( - paths.targetPublic, - // If we've got a separate public index entry point, copy public content there instead - publicPaths?.targetDist ?? paths.targetDist, - { + await fs.copy(paths.targetPublic, paths.targetDist, { + dereference: true, + filter: file => file !== paths.targetHtml, + }); + + // If we've got a separate public index entry point, copy public content there too + if (publicPaths) { + await fs.copy(paths.targetPublic, publicPaths.targetDist, { dereference: true, filter: file => file !== paths.targetHtml, - }, - ); + }); + } } if (configSchema) {