From 49d67d997a2e6334f1422bc337d2f10d0063c945 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 4 Jun 2020 11:05:26 +0200 Subject: [PATCH] packages/cli: copy public dir during bundle --- packages/cli/src/lib/bundler/bundle.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/cli/src/lib/bundler/bundle.ts b/packages/cli/src/lib/bundler/bundle.ts index c7860c0f42..ad1a63ebaf 100644 --- a/packages/cli/src/lib/bundler/bundle.ts +++ b/packages/cli/src/lib/bundler/bundle.ts @@ -48,6 +48,13 @@ export async function buildBundle(options: BuildOptions) { const previousFileSizes = await measureFileSizesBeforeBuild(paths.targetDist); await fs.emptyDir(paths.targetDist); + if (paths.targetPublic) { + await fs.copy(paths.targetPublic, paths.targetDist, { + dereference: true, + filter: file => file !== paths.targetHtml, + }); + } + const { stats } = await build(compiler, isCi).catch(error => { console.log(chalk.red('Failed to compile.\n')); throw new Error(`Failed to compile.\n${error.message || error}`);