-
Notifications
You must be signed in to change notification settings - Fork 417
Description
Hi,
I've noticed that when trying to deploy individual functions (with package -> individually: true
in serverless.yml) the change made in #48 has fixed the exception (thank you!), but the function isn't being packed.
In my use case, this leads to a ~19MB .zip being uploaded compared to a ~600kb .zip when I do a full deploy.
A Pull Request was merged and released along with the serverless 1.2.0 milestone yesterday that added a before:deploy:function:packageFunction
hook, which I have (naively and probably incorrectly) added to index.js
as follows:
'before:deploy:function:packageFunction': () => BbPromise.bind(this)
.then(this.validate)
.then(this.compile),
So now when I run serverless deploy function --function <myFunction>
it packages it (as illustrated below):
Without hook:
➜ api git:(master) ✗ serverless deploy function --function myFunction
Serverless: Deploying function: myFunction...
Serverless: Packaging function: myFunction...
Serverless: Uploading function: myFunction (19.9 MB)...
Serverless: Successfully deployed function: myFunction
With hook:
➜ api git:(master) ✗ serverless deploy function --function myFunction
Serverless: Deploying function: myFunction...
Serverless: Bundling with Webpack...
Time: 2337ms
Asset Size Chunks Chunk Names
handler.js 1.92 MB 0 [emitted] main
Serverless: Packaging function: myFunction...
Serverless: Uploading function: myFunction (606.73 KB)...
Serverless: Successfully deployed function: myFunction
Would it be possible to please have support for this hook added at some point? I'm happy to make a pull request for it if the way I've added it is acceptable, but didn't want to just assume it was correct.
Thanks