serverless-layers
serverless-layers copied to clipboard
Force excluding / including packages
How should I go about excluding aws-sdk from the layer?
Hello, @ptimson . You can remove aws-sdk from dependencies and place it in devDependencies.
Thanks for the response @agutoli. Seem's like a good work around.
I do like the serverless-webpack approach to this issue:
https://github.com/serverless-heaven/serverless-webpack#forced-exclusion
I don't think inclusion makes sense with this lib as everything is included anyway! (Unless you are force including a dev dependency). But I feel like the force exclusion may be useful both for this case and maybe others where a dependency has dependencies that your code doesn't use. Then again maybe this is more what https://github.com/beforeyoubid/serverless-webpack-layers aims to achieve.
I could work on a PR for it.
Yes, that's is a good feature to implement.
I ran into this as well, with a complex issue not worth explaining here. Another option is to customize your serverless-layers installation command:
serverless-layers:
packageManager: yarn
customInstallationCommand: yarn install --production && rm -rd ./node_modules/your-package-name
The remove command is executed in the temporary folder, so it will not affect your development environment or your CI/CD pipelines.
Thanks for the response @agutoli. Seem's like a good work around.
I do like the
serverless-webpackapproach to this issue: https://github.com/serverless-heaven/serverless-webpack#forced-exclusionI don't think inclusion makes sense with this lib as everything is included anyway! (Unless you are force including a dev dependency). But I feel like the force exclusion may be useful both for this case and maybe others where a dependency has dependencies that your code doesn't use. Then again maybe this is more what https://github.com/beforeyoubid/serverless-webpack-layers aims to achieve.
I could work on a PR for it.
Is this still being worked on?
please try: [email protected]