Hi folks,
Iβve being testing the package feature in multiple scenarios to see which one would fit best our project. We use nodejs based functions and Iβd like to create individual packages per-functions, where which function have its own node_modules in its directory, however we have a top level node_modules with common requires that would be added using the package config as state in package dos.
It seems sls does create individual packages however they all contain all functions instead of theyβre own. Is this how it was supposed to work?
Thanks,
sls version: 1.0.0-rc-1
serverless.yml
service: aws-nodejs # NOTE: update this with your service name
provider:
name: aws
runtime: nodejs4.3
stage: dev
package:
individually: true
functions:
user:
handler: user/handler.hello
account:
handler: account/handler.hello
directory layout
.
βββ account
β βββ event.json
β βββ handler.js
β βββ package.json
βββ package.json
βββ serverless.yml
βββ user
βββ event.json
βββ handler.js
βββ package.json
sls package1.zip
[eric@gross sls-multi-pkg]$ unzip -l .serverless/aws-nodejs-dev-account.zip
Archive: .serverless/aws-nodejs-dev-account.zip
Length Date Time Name
--------- ---------- ----- ----
63 2016-09-19 12:24 account/event.json
324 2016-09-19 12:24 account/handler.js
254 2016-09-19 12:24 account/package.json
252 2016-09-19 12:24 package.json
63 2016-09-19 12:24 user/event.json
316 2016-09-19 12:24 user/handler.js
246 2016-09-19 12:24 user/package.json
--------- -------
1518 7 files
sls package2.zip
[eric@gross sls-multi-pkg]$ unzip -l .serverless/aws-nodejs-dev-user.zip
Archive: .serverless/aws-nodejs-dev-user.zip
Length Date Time Name
--------- ---------- ----- ----
63 2016-09-19 12:24 account/event.json
324 2016-09-19 12:24 account/handler.js
254 2016-09-19 12:24 account/package.json
252 2016-09-19 12:24 package.json
63 2016-09-19 12:24 user/event.json
316 2016-09-19 12:24 user/handler.js
246 2016-09-19 12:24 user/package.json
--------- -------
1518 7 files