Skip to content

Commit 9d621c7

Browse files
devversiontinayuangao
authored andcommitted
build: livereload not working for cdk changes (#5452)
When serving the demo-app the Material package will be watched using the generated `material:watch` task. This does not mean that the `cdk:watch` task will run too because Material depends on the CDK. With this change, the watch task will now also run the watch tasks of the packages it depends on.
1 parent c9f7f46 commit 9d621c7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/package-tools/gulp/build-tasks-gulp.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
4343
// Glob that matches every HTML file in the current package.
4444
const htmlGlob = join(packageRoot, '**/*.html');
4545

46+
// List of watch tasks that need run together with the watch task of the current package.
47+
const dependentWatchTasks = requiredPackages.map(pkgName => `${pkgName}:watch`);
48+
4649
/**
4750
* Main tasks for the package building. Tasks execute the different sub-tasks in the correct
4851
* order.
@@ -86,7 +89,9 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
8689
* Asset tasks. Building SASS files and inlining CSS, HTML files into the ESM output.
8790
*/
8891
task(`${packageName}:assets`, [
89-
`${packageName}:assets:scss`, `${packageName}:assets:copy-styles`, `${packageName}:assets:html`
92+
`${packageName}:assets:scss`,
93+
`${packageName}:assets:copy-styles`,
94+
`${packageName}:assets:html`
9095
]);
9196

9297
task(`${packageName}:assets:scss`, buildScssTask(packageOut, packageRoot, true));
@@ -102,7 +107,7 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
102107
/**
103108
* Watch tasks, that will rebuild the package whenever TS, SCSS, or HTML files change.
104109
*/
105-
task(`${packageName}:watch`, () => {
110+
task(`${packageName}:watch`, dependentWatchTasks, () => {
106111
watch(join(packageRoot, '**/*.+(ts|scss|html)'), [`${packageName}:build`, triggerLivereload]);
107112
});
108113
}

0 commit comments

Comments
 (0)