File tree Expand file tree Collapse file tree 2 files changed +26
-27
lines changed
packages/open-next/src/build Expand file tree Collapse file tree 2 files changed +26
-27
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { buildSync } from "esbuild";
66import type { OpenNextConfig } from "types/open-next.js" ;
77
88import logger from "../logger.js" ;
9- import { buildDevConfig } from "./helper .js" ;
9+ import { DEV_CONFIG } from "./constant .js" ;
1010import { validateConfig } from "./validateConfig.js" ;
1111
1212/**
@@ -129,3 +129,28 @@ export function compileOpenNextConfigEdge(
129129 external : externals ,
130130 } ) ;
131131}
132+
133+ function buildDevConfig ( outputPath : string , externals : string [ ] ) {
134+ buildSync ( {
135+ stdin : {
136+ contents : DEV_CONFIG ,
137+ resolveDir : process . cwd ( ) ,
138+ loader : "ts" ,
139+ sourcefile : "open-next.config.ts" ,
140+ } ,
141+ outfile : outputPath ,
142+ bundle : true ,
143+ format : "esm" ,
144+ target : [ "node18" ] ,
145+ external : externals ,
146+ platform : "node" ,
147+ banner : {
148+ js : [
149+ "import { createRequire as topLevelCreateRequire } from 'module';" ,
150+ "const require = topLevelCreateRequire(import.meta.url);" ,
151+ "import bannerUrl from 'url';" ,
152+ "const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));" ,
153+ ] . join ( "" ) ,
154+ } ,
155+ } ) ;
156+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import type {
1111} from "types/open-next.js" ;
1212
1313import logger from "../logger.js" ;
14- import { DEV_CONFIG } from "./constant.js" ;
1514
1615const require = createRequire ( import . meta. url ) ;
1716const __dirname = url . fileURLToPath ( new URL ( "." , import . meta. url ) ) ;
@@ -441,28 +440,3 @@ export async function isEdgeRuntime(
441440export function getPackagePath ( options : BuildOptions ) {
442441 return path . relative ( options . monorepoRoot , options . appBuildOutputPath ) ;
443442}
444-
445- export function buildDevConfig ( outputPath : string , externals : string [ ] ) {
446- buildSync ( {
447- stdin : {
448- contents : DEV_CONFIG ,
449- resolveDir : process . cwd ( ) ,
450- loader : "ts" ,
451- sourcefile : "open-next.config.ts" ,
452- } ,
453- outfile : outputPath ,
454- bundle : true ,
455- format : "esm" ,
456- target : [ "node18" ] ,
457- external : externals ,
458- platform : "node" ,
459- banner : {
460- js : [
461- "import { createRequire as topLevelCreateRequire } from 'module';" ,
462- "const require = topLevelCreateRequire(import.meta.url);" ,
463- "import bannerUrl from 'url';" ,
464- "const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));" ,
465- ] . join ( "" ) ,
466- } ,
467- } ) ;
468- }
You can’t perform that action at this time.
0 commit comments