devDependencies are not excluded all of a sudden...
Are you certain it's a bug?
- [X] Yes, it looks like a bug
Is the issue caused by a plugin?
- [X] It is not a plugin issue
Are you using the latest v3 release?
- [X] Yes, I'm using the latest v3 release
Is there an existing issue for this?
- [X] I have searched existing issues, it hasn't been reported yet
Issue description
I found the issue for devDependencies not being excluded for the parent directory issue, but we have our serverless.yml in the root, along with te node_modules.
We have had this working fine previously, and the deploy size of the Lambdas has been around 31 MB.
Now we hit 110 MB and the deploy fails as the unpackaged size exceeds 360 MB(!).
Extracting the ZIP I can see that all dependecises are there, e.g. serverless, aws-sdk, eslint etc.
What have I messed up?
Service configuration (serverless.yml) content
frameworkVersion: '3'
package:
individually: true
excludeDevDependencies: true
patterns:
- '!volume/**' # exclude any Localstack temporary files/directories
- '!coverage/**'
- '!db-data/**'
- '!.serverless/**'
- '!.vscode/**'
- '!test/**'
- '!aws/**'
- '!dist/**'
### Command name and used flags
sls deploy -s test
### Command output
```shell
The verbose logging shows it is excluding dependencise:
stage: test
Packaging
Excluding development dependencies for function "migrator"
Excluding development dependencies for function "create-access-key"
Excluding development dependencies for function "integrationInternal"
Excluding development dependencies for function "integrationExternal"
Excluding development dependencies for function "internalRoutes"
### Environment information
```shell
Framework Core: 3.38.0 (local)
Plugin: 7.2.2
SDK: 4.5.1
node v18.14.2 (npm v9.5.0)
The work around for now is to get the list of "real" dependencies is:
rm -r node_modulesnpm install --omit=devls node_modules- Copy the list (it's looong) and fix all directory names as e.g.
- 'node_modules/@qvalia/**' - add
- '!node_modules/**'underpatterns:inserverless.yml(to exclude anything undernode_modules) - Add the list of
omit=devmodules toserverless.ymlunder the excluded!node_modules:
Now you can deploy... From having 110MB deployment ZIP this brought us down to 22MB...
Has this being fixed yet?
We now have the same issue on three more of our repositories... Anyone that has any input to why this is happening?
We have a project (different from the one above) that has been built and managed on Mac only, but as soon as a Windows client running WSL2 (Ubunutu) tried to run the same we got a node_modules of 340 MB on the Windows machine, while the Mac has it at 26 MB.
Comparing the two deployment ZIP packages we can see that on Windows a lot of (all?) devDependencies, including serverless, is included in the ZIP making it massive...
Environment: linux, node 18.14.2, framework 3.39.0 (local), plugin 7.2.3, SDK 4.5.1