Excluding @aws-sdk packages from the output of serverless package command in Serverless Framework.

huangapple go评论70阅读模式
英文:

Excluding @aws-sdk packages from the output of serverless package command in Serverless Framework

问题

I am using the Serverless Framework to deploy my AWS Lambda functions. I want to exclude the "@aws-sdk" packages from the build file generated by the serverless package command. I have tried using both the exclude property and forceExclude option in my serverless.yml file, but the "@aws-sdk" packages still appear in the build file.

Here's my current configuration in serverless.yml:

service: my-service

provider:
  name: aws
  runtime: nodejs14.x

package:
  exclude:
    - node_modules/**
  # I have also tried using forceExclude:
  # forceExclude:
  #   - node_modules/aws-sdk/**

functions:
  # function configurations...

I have double-checked that the exclude property is correctly set, and I have restarted the deployment process multiple times, but the @aws-sdk packages keep showing up in the build file.

Is there any other approach or configuration option that I'm missing? How can I effectively exclude the @aws-sdk packages from the output of the serverless package command? Any help would be appreciated. Thank you!

英文:

I am using the Serverless Framework to deploy my AWS Lambda functions. I want to exclude the "@aws-sdk" packages from the build file generated by the serverless package command. I have tried using both the exclude property and forceExclude option in my serverless.yml file, but the "@aws-sdk" packages still appear in the build file.

Here's my current configuration in serverless.yml:

service: my-service

provider:
  name: aws
  runtime: nodejs14.x

package:
  exclude:
    - node_modules/**
  # I have also tried using forceExclude:
  # forceExclude:
  #   - node_modules/aws-sdk/**

functions:
  # function configurations...

I have double-checked that the exclude property is correctly set, and I have restarted the deployment process multiple times, but the @aws-sdk packages keep showing up in the build file.

Is there any other approach or configuration option that I'm missing? How can I effectively exclude the @aws-sdk packages from the output of the serverless package command? Any help would be appreciated. Thank you!

答案1

得分: 2

默认情况下,serverless-esbuild会排除aws-sdk的第2版。如果您使用的是第3版,文件夹名称不同。它是@aws-sdk,因此您必须在配置中添加如下内容:

custom:
  esbuild:
    exclude:
      - "@aws-sdk"
英文:

By default, serverless-esbuild excludes aws-sdk version 2. If you are using version 3, the folder name is different. It is @aws-sdk, so you must add this on your configuration

custom:
  esbuild:
    exclude:
      - "@aws-sdk"

huangapple
  • 本文由 发表于 2023年5月11日 05:42:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76222731.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定