From c3d4e8b170b405ef420236f12d7b19e21e541a81 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Mon, 29 Jul 2024 11:02:30 -0700 Subject: [PATCH] fix(compiler): run copy task after other output targets (#5902) * fix(compiler): run copy task after other output targets * run secondary tasks in parallel --- src/compiler/output-targets/index.ts | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/compiler/output-targets/index.ts b/src/compiler/output-targets/index.ts index e88d7641f04..2ef5aa5b622 100644 --- a/src/compiler/output-targets/index.ts +++ b/src/compiler/output-targets/index.ts @@ -28,7 +28,6 @@ export const generateOutputTargets = async ( invalidateRollupCaches(compilerCtx); await Promise.all([ - outputCopy(config, compilerCtx, buildCtx), outputCollection(config, compilerCtx, buildCtx, changedModuleFiles), outputCustomElements(config, compilerCtx, buildCtx), outputHydrateScript(config, compilerCtx, buildCtx), @@ -36,17 +35,23 @@ export const generateOutputTargets = async ( outputLazy(config, compilerCtx, buildCtx), ]); - // the www output target depends on the output of the lazy output target - // since it attempts to inline the lazy build entry point into `index.html` - // so we want to ensure that the lazy OT has already completed and written - // all of its files before the www OT runs. - await outputWww(config, compilerCtx, buildCtx); - - // must run after all the other outputs - // since it validates files were created - await outputDocs(config, compilerCtx, buildCtx); - await outputTypes(config, compilerCtx, buildCtx); - await outputCustom(config, compilerCtx, buildCtx); + await Promise.all([ + // the user may want to copy compiled assets which requires above tasks to + // have finished first + outputCopy(config, compilerCtx, buildCtx), + + // the www output target depends on the output of the lazy output target + // since it attempts to inline the lazy build entry point into `index.html` + // so we want to ensure that the lazy OT has already completed and written + // all of its files before the www OT runs. + outputWww(config, compilerCtx, buildCtx), + + // must run after all the other outputs + // since it validates files were created + outputDocs(config, compilerCtx, buildCtx), + outputTypes(config, compilerCtx, buildCtx), + outputCustom(config, compilerCtx, buildCtx), + ]); timeSpan.finish('generate outputs finished'); };