Skip to content

Commit

Permalink
fix(config): fix incorrectly merging default options
Browse files Browse the repository at this point in the history
default config and custom options were being merged incorrectly using ramda

fix #18, fix #19
  • Loading branch information
floydspace committed Jun 26, 2020
1 parent 7ffbc25 commit 1229d59
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { build, BuildOptions } from 'esbuild';
import * as fs from 'fs-extra';
import * as globby from 'globby';
import * as path from 'path';
import { compose, concat, mergeWith, uniq } from 'ramda';
import { mergeRight } from 'ramda';
import * as Serverless from 'serverless';
import * as Plugin from 'serverless/classes/Plugin';
import * as Service from 'serverless/classes/Service';
Expand Down Expand Up @@ -43,9 +43,8 @@ export class EsbuildPlugin implements Plugin {
this.options = options;
this.packExternalModules = packExternalModules.bind(this);

const concatUniq = compose(uniq, concat as (l1: Configuration[], l2: Configuration[]) => Configuration[]);
const withDefaultOptions = mergeWith(concatUniq, DEFAULT_BUILD_OPTIONS);
this.buildOptions = withDefaultOptions(this.serverless.service.custom?.esbuild ?? {});
const withDefaultOptions = mergeRight(DEFAULT_BUILD_OPTIONS);
this.buildOptions = withDefaultOptions<Configuration>(this.serverless.service.custom?.esbuild ?? {});

this.hooks = {
'before:run:run': async () => {
Expand Down

0 comments on commit 1229d59

Please sign in to comment.