@@ -210,31 +210,35 @@ async function generateBundle(
210210 ] ;
211211
212212 const outfileExt = fnOptions . runtime === "deno" ? "ts" : "mjs" ;
213- await buildHelper . esbuildAsync ( {
214- entryPoints : [
215- path . join ( options . openNextDistDir , "adapters" , "server-adapter.js" ) ,
216- ] ,
217- external : [ "next" , "./middleware.mjs" , "./next-server.runtime.prod.js" ] ,
218- outfile : path . join ( outputPath , packagePath , `index.${ outfileExt } ` ) ,
219- banner : {
220- js : [
221- `globalThis.monorepoPackagePath = "${ packagePath } ";` ,
222- "import process from 'node:process';" ,
223- "import { Buffer } from 'node:buffer';" ,
224- "import { createRequire as topLevelCreateRequire } from 'module';" ,
225- "const require = topLevelCreateRequire(import.meta.url);" ,
226- "import bannerUrl from 'url';" ,
227- "const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));" ,
228- name === "default" ? "" : `globalThis.fnName = "${ name } ";` ,
229- ] . join ( "" ) ,
213+ await buildHelper . esbuildAsync (
214+ {
215+ entryPoints : [
216+ path . join ( options . openNextDistDir , "adapters" , "server-adapter.js" ) ,
217+ ] ,
218+ external : [ "next" , "./middleware.mjs" , "./next-server.runtime.prod.js" ] ,
219+ outfile : path . join ( outputPath , packagePath , `index.${ outfileExt } ` ) ,
220+ banner : {
221+ js : [
222+ `globalThis.monorepoPackagePath = "${ packagePath } ";` ,
223+ "import process from 'node:process';" ,
224+ "import { Buffer } from 'node:buffer';" ,
225+ "import { createRequire as topLevelCreateRequire } from 'module';" ,
226+ "const require = topLevelCreateRequire(import.meta.url);" ,
227+ "import bannerUrl from 'url';" ,
228+ "const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));" ,
229+ name === "default" ? "" : `globalThis.fnName = "${ name } ";` ,
230+ ] . join ( "" ) ,
231+ } ,
232+ plugins,
233+ alias : {
234+ ...( isBundled
235+ ? {
236+ "next/dist/server/next-server.js" :
237+ "./next-server.runtime.prod.js" ,
238+ }
239+ : { } ) ,
240+ } ,
230241 } ,
231- plugins,
232- alias : {
233- ...( isBundled
234- ? { "next/dist/server/next-server.js" : "./next-server.runtime.prod.js" }
235- : undefined ) ,
236- }
237- } ,
238242 options ,
239243 ) ;
240244
0 commit comments