aws-amplify / aws-amplify/amplify-cli
Option to not install function node_modules on push
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
Amplify appears to be automatically installing function `node_modules` on `push`.
I have several Node.js lambda functions. I package the lambda entry point with required run-time dependencies as a pre-push step in order to reduce the published zip size. All of these dependencies are included under `devDependencies` instead of `dependencies` as they are not technically needed at run-time - they've been packaged up.
When I execute `amplify push` or `amplify function push`, I see all dependencies installed under each function shortly after executing the command. I imagine this was a decision made to ease deployment, but it creates issues in my situation where I consciously do not want the extra dependencies included in the Lambda zip, as I run into a Lambda size error (`Unzipped size must be smaller than 262144000 bytes`). If the extra install step is deliberate, is there a reason why it isn't a production install, i.e. `npm install --production`, so that `devDependencies` are not installed?
**Amplify CLI Version**
4.23.0
**To Reproduce**
1. Create a Lambda function with a `devDepenency`
2. Execute `amplify push`
3. Observe that the `devDependency` has been installed within the function `node_modules`.
**Expected behavior**
Amplify either does not automatically install `node_modules`, or makes the behavior configurable via a CLI argument.
**Desktop (please complete the following information):**
- OS: Debian 10
- Node Version. 12.13.1
**Additional context**
I see there is an `amplify function build` that automatically installs function node_modules. Is this command getting run on `push`?
Contributor guide
Assessment
This issue has not been assessed yet.