Skip to content

Commit

Permalink
fix: don't dispose build contexts
Browse files Browse the repository at this point in the history
Previously the build results were stored in a cache, but the context was
immediately disposed. This caused an error because the context object
was still in the cache, so when rebuilding it tried to call .rebuild()
on the context on line 97 which threw an exception because you can't
call rebuild on disposed contexts.

I don't get why contexts are stored in a cache and tried rebuilding on
if they are disposed, so I removed disposing them all together. If they
should still be disposed, the context needs to be completely removed, so
it doesn't try calling rebuild on it.

Fixes #439
  • Loading branch information
trygveaa authored and floydspace committed Apr 15, 2023
1 parent af53cd0 commit c16529d
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,5 @@ export async function bundle(this: EsbuildServerlessPlugin, incremental = false)
})
.filter((result): result is FunctionBuildResult => typeof result === 'object');

// dispose of long-running build contexts
Object.entries(this.buildCache).forEach((entry) => {
entry[1].context?.dispose();
});

this.log.verbose('Compiling completed.');
}

0 comments on commit c16529d

Please sign in to comment.