File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import type {
3434 ImprovedServerlessOptions ,
3535 Plugins ,
3636 ReturnPluginsFn ,
37+ ESMPluginsModule ,
3738} from './types' ;
3839
3940function updateFile ( op : string , src : string , dest : string ) {
@@ -254,7 +255,13 @@ class EsbuildServerlessPlugin implements ServerlessPlugin {
254255 return this . buildOptions . plugins ;
255256 }
256257
257- const plugins : Plugins | ReturnPluginsFn = require ( path . join ( this . serviceDirPath , this . buildOptions . plugins ) ) ;
258+ let plugins : Plugins | ReturnPluginsFn | ESMPluginsModule = require (
259+ path . join ( this . serviceDirPath , this . buildOptions . plugins )
260+ ) ;
261+
262+ if ( plugins . default ) {
263+ plugins = plugins . default ;
264+ }
258265
259266 if ( typeof plugins === 'function' ) {
260267 return plugins ( this . serverless ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export type ConfigFn = (sls: Serverless) => Configuration;
66
77export type Plugins = Plugin [ ] ;
88export type ReturnPluginsFn = ( sls : Serverless ) => Plugins ;
9+ export type ESMPluginsModule = { default : Plugins | ReturnPluginsFn } ;
910
1011export interface ImprovedServerlessOptions extends Serverless . Options {
1112 package ?: string ;
You can’t perform that action at this time.
0 commit comments