File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import type {
34
34
ImprovedServerlessOptions ,
35
35
Plugins ,
36
36
ReturnPluginsFn ,
37
+ ESMPluginsModule ,
37
38
} from './types' ;
38
39
39
40
function updateFile ( op : string , src : string , dest : string ) {
@@ -254,7 +255,13 @@ class EsbuildServerlessPlugin implements ServerlessPlugin {
254
255
return this . buildOptions . plugins ;
255
256
}
256
257
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
+ }
258
265
259
266
if ( typeof plugins === 'function' ) {
260
267
return plugins ( this . serverless ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export type ConfigFn = (sls: Serverless) => Configuration;
6
6
7
7
export type Plugins = Plugin [ ] ;
8
8
export type ReturnPluginsFn = ( sls : Serverless ) => Plugins ;
9
+ export type ESMPluginsModule = { default : Plugins | ReturnPluginsFn } ;
9
10
10
11
export interface ImprovedServerlessOptions extends Serverless . Options {
11
12
package ?: string ;
You can’t perform that action at this time.
0 commit comments