@@ -20,6 +20,9 @@ const TYPESCRIPT_PLUGIN_BUILD_DIR_WEBPACK = '.webpack/service'; //TODO detect fr
2020// Plugin naming and build directory of serverless-webpack plugin
2121const TS_PLUGIN_ESBUILD = 'EsbuildServerlessPlugin' ;
2222const TYPESCRIPT_PLUGIN_BUILD_DIR_ESBUILD = '.esbuild/.build' ; //TODO detect from esbuild.config.js
23+ // Plugin naming and build directory of esbuild built-in with Serverless Framework
24+ const TS_PLUGIN_BUILTIN_ESBUILD = 'Esbuild' ;
25+ const TYPESCRIPT_PLUGIN_BUILD_DIR_BUILTIN_ESBUILD = '.serverless/build' ; //TODO detect from esbuild.config.js
2326
2427// Default AWS endpoint URL
2528const DEFAULT_AWS_ENDPOINT_URL = 'http://localhost:4566' ;
@@ -292,6 +295,13 @@ class LocalstackPlugin {
292295 if ( this . findPlugin ( TS_PLUGIN_TSC ) ) return TS_PLUGIN_TSC ;
293296 if ( this . findPlugin ( TS_PLUGIN_WEBPACK ) ) return TS_PLUGIN_WEBPACK ;
294297 if ( this . findPlugin ( TS_PLUGIN_ESBUILD ) ) return TS_PLUGIN_ESBUILD ;
298+ const builtinEsbuildPlugin = this . findPlugin ( TS_PLUGIN_BUILTIN_ESBUILD ) ;
299+ if ( builtinEsbuildPlugin &&
300+ builtinEsbuildPlugin . constructor &&
301+ typeof builtinEsbuildPlugin . constructor . WillEsBuildRun === 'function' &&
302+ builtinEsbuildPlugin . constructor . WillEsBuildRun ( this . serverless . configurationInput , this . serverless . serviceDir ) ) {
303+ return TS_PLUGIN_BUILTIN_ESBUILD ;
304+ }
295305 return undefined ;
296306 }
297307
@@ -303,6 +313,9 @@ class LocalstackPlugin {
303313 return TYPESCRIPT_PLUGIN_BUILD_DIR_WEBPACK ;
304314 if ( TS_PLUGIN === TS_PLUGIN_ESBUILD )
305315 return TYPESCRIPT_PLUGIN_BUILD_DIR_ESBUILD ;
316+ if ( TS_PLUGIN === TS_PLUGIN_BUILTIN_ESBUILD ) {
317+ return TYPESCRIPT_PLUGIN_BUILD_DIR_BUILTIN_ESBUILD ;
318+ }
306319 return undefined ;
307320 }
308321
0 commit comments