Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,12 @@ class EsbuildServerlessPlugin implements ServerlessPlugin {

const configPath: string | undefined = this.serverless.service.custom?.esbuild?.config;

const config: ConfigFn | undefined = configPath ? require(path.join(this.serviceDirPath, configPath)) : undefined;
const config: ConfigFn | undefined = (() => {
if(!configPath) return undefined
const modPath = path.join(this.serviceDirPath, configPath);
const mod = require(modPath);
return mod?.default ?? mod;
})();

return withResolvedOptions<Configuration>(
config ? config(this.serverless) : this.serverless.service.custom?.esbuild ?? {}
Expand Down