serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

have serverless.yml esbuild buildOptions override esbuild.config

Open codingnuclei opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. If a buildOption exists in both the config file and in the serverless file, the config value win. I am using a pattern whereby multiple services are using the same config file as a "base". For some services I wish to override these base values. Currently this doesn't seem to work (unless I am missing something).

Describe the solution you'd like To have serverless file declared buildOptions override config file ones.

https://github.com/floydspace/serverless-esbuild/blob/2c1d2ac842ac4270c48028d123887193ae957af2/src/index.ts#L253

mergeLeft instead?

This makes sense to me but open to being told im wrong :)

Describe alternatives you've considered Use config files for every service. Import the base config and perform own overrides as desired.

Update

Just re-read the code - looks like if you are using a config file then all other options are ignored. I actually have no issue with not supporting using both configuration methods at the same time.

Maybe just worth a README.md update to make this explicit i.e. Setting a config path will cause options set in the serverless configuration file to be ignored.

codingnuclei avatar Jul 16 '22 11:07 codingnuclei

I'm pretty sure there are configuration options, such as concurrency, which cannot be provided by the config file, but which are not picked up from custom if a config file is set.

mattkindy avatar Mar 20 '25 18:03 mattkindy