Packaging - Include not working?

Hi

I package my functions individually and only include the part i want. This used to work, but i think as of my update to 1.0.3 it doesnt anymore.

This is the kind of thing im doing:

package:
individually: true
exclude:
- login-handler.js
- signup-handler.js
- verify-handler.js
- resend-handler.js
- forgotten-password-handler.js
- reset-password-handler.js
- change-password-handler.js
- event.json

functions:
login:
name: login
handler: login-handler.handler
package:
include:
- login-handler.js
memorySize: 128

Now in my login method there is nothing. It exludes everything but doesnt include. Is there a feature change im not aware of?

Thanks

It was changed to use globs for exclusion, at which point it stopped supporting include. (https://github.com/serverless/serverless/pull/2194)

Looks like they’ve just merged in a PR that will allow includes again, though not with the old syntax. (https://github.com/serverless/serverless/pull/2266)

1 Like

Yeah, looks like the PR @vyh mentioned is the way to do it today…

There is a much bigger discussion related to this going on in https://github.com/serverless/serverless/issues/2460.

Cool thanks guys ill just include all for now and see how things turn out

so now there is no possibility to include a specific file for only one function? (or do i understand the new syntax wrong?)

and so the package-documentation is wrong: https://serverless.com/framework/docs/providers/aws/guide/packaging/
-.-

1 Like

Yes, you can include a file in a specific function; Unfortunately it involves a double negative (as per the docs you linked).

In your function’s package options you can put a ! in front of the file you want to include as one of the exclude entries… I feel a bit silly writing that, but that’s the current implementation.

Again, this is currently under discussion in issue I linked above and I’m hoping it gets sorted for the next release.

1 Like

thank you. the syntax is not nice, but if it work, i can live with it.

1 Like