Skip to content

Fix resolution of invoke local related lifecycle hook #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ export class TypeScriptPlugin {
})
}
},
'after:invoke:local:invoke': () => {
'after:invoke:local:invoke': async () => {
if (this.options.watch) {
this.watchFunction()
this.serverless.cli.log('Waiting for changes...')
await this.watchFunction()
}
}
}
Expand Down Expand Up @@ -117,10 +116,13 @@ export class TypeScriptPlugin {
}

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

this.isWatching = true
watchFiles(this.rootFileNames, this.originalServicePath, () => {
this.serverless.pluginManager.spawn('invoke:local')
await new Promise((resolve, reject) => {
watchFiles(this.rootFileNames, this.originalServicePath, () => {
this.serverless.pluginManager.spawn('invoke:local').catch(reject)
})
})
}

Expand Down