-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support BuildProperties/BuildMethod config for multiple functions #3713
Comments
@iRoachie Thanks for the feature request. Globals happens as apart of the SAM Transform, so I don't think we want to support this locally or in SAM. However, I do see a need for something like this and what I think you are asking for is to be able to set build args for all your buildable resources similar to how you could do this by using esbuild or other tooling (either in the command line or rc files.). If the intention is correct above, I will flag this for our PM to review. |
I wasn't sure how it could be done, but yes the intent is correct. |
Agree, the commonality is needed to be placed in the Globals > Function section, with the exception for EntryPoints. I also believe EntryPoints should THEN be more easily configured inside the Resources portion, because Metadata > BuildProperties > EntryPoints > app.ts is just too lengthy. |
Thanks for your feedback. Since esbuild support is still beta, we will work with our PM to find an alternative way, which should resolve this issue. |
Any news on this one? It is stopper for us when it comes to using esbuild. |
One workaround is to use yaml anchor merges (name something, then reuse), e.g. x-anchors:
Metadata: &esb_meta
BuildMethod: esbuild
BuildProperties: &esb_props
Minify: true
Target: es2020
Sourcemap: true
Packages: external
Resources:
FunctionAlpha:
Type: AWS::Serverless::Function
Properties:
FunctionName: func-alpha
Handler: handler.lambdaHandler
Metadata:
<<: *esb_meta
BuildProperties:
<<: *esb_props
EntryPoints:
- handlers/alpha/handler.ts
FunctionBeta:
Type: AWS::Serverless::Function
Properties:
FunctionName: func-beta
Handler: handler.lambdaHandler
Metadata:
<<: *esb_meta
BuildProperties:
<<: *esb_props
EntryPoints:
- handlers/beta/handler.ts Ignore possible tooling errors saying it's not allowed. SAM CLI 1.95.0 seems to handle it just fine unless you |
@yegorpetrov How about this? It should works on both
|
Yes, that's what we ended up with for now. |
Describe your idea/feature/enhancement
Hey folks, super pumped about the new typescript + esbuild feature. One annoying thing I noticed is that for every function resource, I have to specify a metadata field with the esbuild options. You can imagine how repetitive this can get with multiple functions.
e.g.
Proposal
Would be awesome if we could somehow add this to the
Globals
section of the sam template. e.g If I wanted to use esbuild for all my functions.The same would be great to have for LayerVersion.
The text was updated successfully, but these errors were encountered: