Skip to content

Commit c8a0ab6

Browse files
committed
perf(build): skip lazy build when html change
1 parent c89985e commit c8a0ab6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/compiler/component-lazy/generate-lazy-app.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { generateCjs } from './generate-cjs';
1010
import { generateModuleGraph } from '../entries/component-graph';
1111

1212
export async function generateLazyLoadedApp(config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, outputTargets: d.OutputTargetDistLazy[]) {
13+
if (canSkipLazyBuild(buildCtx)) {
14+
return;
15+
}
1316
const timespan = buildCtx.createTimeSpan(`bundling components started`);
1417

1518
const cmps = buildCtx.components;
@@ -148,3 +151,13 @@ function getLegacyLoader(config: d.Config) {
148151
149152
})(document);`;
150153
}
154+
155+
export function canSkipLazyBuild(buildCtx: d.BuildCtx) {
156+
if (buildCtx.requiresFullBuild) {
157+
return false;
158+
}
159+
if (buildCtx.isRebuild && (buildCtx.hasScriptChanges || buildCtx.hasStyleChanges)) {
160+
return false;
161+
}
162+
return true;
163+
}

0 commit comments

Comments
 (0)