From ea9d96c97f1c911a41ec77f7626d4e3630bf6149 Mon Sep 17 00:00:00 2001 From: Jack Cuthbert Date: Mon, 15 Jul 2019 10:15:23 +1000 Subject: [PATCH] fix: watch files callback missing correct this context After the refactor, I broke this by removing the bind in the hooks. Adding the bind to the callback function retains the this context while keeping the modularity of the hooks property. Fixes #162 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 10fcb5e7..a249ce58 100644 --- a/src/index.ts +++ b/src/index.ts @@ -131,7 +131,7 @@ export class TypeScriptPlugin { this.serverless.cli.log(`Watching typescript files...`) this.isWatching = true - watchFiles(this.rootFileNames, this.originalServicePath, this.compileTs) + watchFiles(this.rootFileNames, this.originalServicePath, this.compileTs.bind(this)) } async compileTs(): Promise {