Skip to content

Commit

Permalink
fix: bug in releas 1.48 (#492)
Browse files Browse the repository at this point in the history
* fix: bug in releas 1.48

* style: fix linting error
  • Loading branch information
floydspace committed Sep 20, 2023
1 parent 36ef92e commit 0d53683
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import type { BuildOptions, BuildResult } from 'esbuild';
import type { BuildOptions } from 'esbuild';
import fs from 'fs-extra';
import pMap from 'p-map';
import path from 'path';
Expand Down Expand Up @@ -100,12 +100,11 @@ export async function bundle(this: EsbuildServerlessPlugin): Promise<void> {
outdir: path.join(buildDirPath, path.dirname(entry)),
};

const pkg = await import('esbuild');
const context: BuildContext = await pkg.context(options);
let result!: BuildResult;
if (context) {
result = await context.rebuild();
} else {
const pkg: any = await import('esbuild');
const context: BuildContext = await pkg?.context(options);
let result = await context?.rebuild();

if (!result) {
result = await pkg.build(options);
}

Expand Down

0 comments on commit 0d53683

Please sign in to comment.