Skip to content

Commit 378f3be

Browse files
committed
fix: Fix resolution of invoke local related lifecycle hook
1 parent 0c2025e commit 378f3be

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: src/index.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ export class TypeScriptPlugin {
6666
})
6767
}
6868
},
69-
'after:invoke:local:invoke': () => {
69+
'after:invoke:local:invoke': async () => {
7070
if (this.options.watch) {
71-
this.watchFunction()
72-
this.serverless.cli.log('Waiting for changes...')
71+
await this.watchFunction()
7372
}
7473
}
7574
}
@@ -117,10 +116,13 @@ export class TypeScriptPlugin {
117116
}
118117

119118
this.serverless.cli.log(`Watch function ${this.options.function}...`)
119+
this.serverless.cli.log('Waiting for changes...')
120120

121121
this.isWatching = true
122-
watchFiles(this.rootFileNames, this.originalServicePath, () => {
123-
this.serverless.pluginManager.spawn('invoke:local')
122+
await new Promise((resolve, reject) => {
123+
watchFiles(this.rootFileNames, this.originalServicePath, () => {
124+
this.serverless.pluginManager.spawn('invoke:local').catch(reject)
125+
})
124126
})
125127
}
126128

0 commit comments

Comments
 (0)