AnomalyInnovations / serverless-bundle

Optimized packages for ES6 and TypeScript Node.js Lambda functions without any configuration.
https://serverless-stack.com/chapters/package-lambdas-with-serverless-bundle.html
MIT License
532 stars 153 forks source link

forceExclude not working #356

Closed hugobcar closed 1 year ago

hugobcar commented 1 year ago

Hi.

I'm using serverless:6.0.0 and I'm having some problems with forceExclude: ["aws-sdk"]. Below is a part of serverless.yml configuration:

custom:
  bundle:
    # stats: true #enable this to see webpack output
    stats: false
    caching: true
    packager: yarn
    forceExclude: ["aws-sdk"]
    excludeFiles: "node_modules/aws-sdk/**"
    copyFiles: # Copy any additional files to the generated package
      - from: "src/modules/aws/chime/index.html" # Where the files are currently
        to: "./src"
      - from: "src/modules/amwell/wsdl/" # Where the files are currently
        to: "./src"
    packagerOptions:
      scripts:
        - rm -rf node_modules/aws-sdk

I'm performing serverless using CodeBuild on AWS.

image

Above you can see the message Excluding external modules: aws-sdk@2.1149.0 in one build, but in some case the build doesn't show this message and I think the forceExclude not working.

Note: The both logs are using the same commit! Sometimes it works and sometimes it doesn't work.

Any ideas?