@@ -31,14 +31,12 @@ const pipe = promisify(pipeline);
3131 * esbuild?: (defaultOptions: BuildOptions) => Promise<BuildOptions> | BuildOptions;
3232 * }} options
3333 */
34- export default function (
35- {
36- out = 'build' ,
37- precompress,
38- env : { host : host_env = 'HOST' , port : port_env = 'PORT' } = { } ,
39- esbuild : esbuildConfig
40- } = { esbuild : ( opts ) => opts }
41- ) {
34+ export default function ( {
35+ out = 'build' ,
36+ precompress,
37+ env : { host : host_env = 'HOST' , port : port_env = 'PORT' } = { } ,
38+ esbuild : esbuildConfig
39+ } = { } ) {
4240 /** @type {import('@sveltejs/kit').Adapter } */
4341 const adapter = {
4442 name : '@sveltejs/adapter-node' ,
@@ -63,7 +61,8 @@ export default function (
6361 host_env
6462 ) } ] || '0.0.0.0';\nexport const port = process.env[${ JSON . stringify ( port_env ) } ] || 3000;`
6563 ) ;
66- const buildOptions = await esbuildConfig ( {
64+ /** @type {BuildOptions } */
65+ const defaultOptions = {
6766 entryPoints : [ '.svelte-kit/node/index.js' ] ,
6867 outfile : join ( out , 'index.js' ) ,
6968 bundle : true ,
@@ -75,7 +74,8 @@ export default function (
7574 define : {
7675 esbuild_app_dir : '"' + config . kit . appDir + '"'
7776 }
78- } ) ;
77+ } ;
78+ const buildOptions = esbuildConfig ? await esbuildConfig ( defaultOptions ) : defaultOptions ;
7979 await esbuild . build ( buildOptions ) ;
8080
8181 utils . log . minor ( 'Prerendering static pages' ) ;
0 commit comments