From 5e26ebf133ef886e170bd4a5c531ed95ae574ebe Mon Sep 17 00:00:00 2001 From: Kevin Perrine Date: Thu, 6 Dec 2018 14:55:37 -0600 Subject: [PATCH] wait until handler is finished before resolving promise Related to #18 and #19. Then waits until the handlers have finished before resolving the promise. --- src/plugin.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index 0189df5..0cdb8ae 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -57,13 +57,13 @@ export default class StackOutputPlugin { const func = splits.pop() || '' const file = splits.join('.') - require(file)[func]( - data, - this.serverless, - this.options - ) - - return Promise.resolve() + return Promise.resolve().then(function() { + return require(file)[func]( + data, + this.serverless, + this.options + ); + }); } private saveFile (data: object) {