Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class EsbuildPlugin implements Plugin {
}
}

async bundle(incremental = false): Promise<BuildResult[]> {
async bundle(incremental = true): Promise<BuildResult[]> {
this.prepare();
this.serverless.cli.log('Compiling with esbuild...');

Expand All @@ -226,9 +226,16 @@ export class EsbuildPlugin implements Plugin {
delete config['watch'];
delete config['pugins'];

const bundlePath = entry.substr(0, entry.lastIndexOf('.')) + '.js';

if (this.buildResults) {
const { result } = this.buildResults.find(({func: fn}) => fn.name === func.name);
await result.rebuild();
return { result, bundlePath, func };
}

const result = await build(config);

const bundlePath = entry.substr(0, entry.lastIndexOf('.')) + '.js';
return { result, bundlePath, func };
})
).then(results => {
Expand Down