DevDependencies were included in serverless v4

I still got the package size issue because the dev dependencies were included. I’m currently using the default build. I got the serverless-python-requirements plugin in the same serverless.yml to slim the Python ML lambda dependencies. For the Node Runtime lambda function, it has its package.

Here’s the package settings in serverless.yml

package:
  individually: true
  patterns:
    - '!**/*'
    - '!venv/**'
    - '!**/*.jpg'
    - '!**/__pycache__/**'
    - '!test_data/**'
    - '!.dvc/**'
    - 'src/**'

functions:
  api:
    runtime: nodejs22.x
    handler: src/api/express.handler
    package:
      patterns:
        - '!**/*'
        - 'node_modules/**'
        - src/api/**

I saw there was a discussion and fix for it but it’s not working for me. I tried the latest version and v4.4.13.

Bug in packaging zip-service.js leading to all dependencies being packaged

Anyone suggestion?