@@ -6,6 +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" ;
910import { validateConfig } from "./validateConfig.js" ;
1011
1112/**
@@ -23,6 +24,7 @@ export async function compileOpenNextConfig(
2324 baseDir : string ,
2425 openNextConfigPath ?: string ,
2526 { nodeExternals = "" , compileEdge = false } = { } ,
27+ dev = false ,
2628) {
2729 const sourcePath = path . join (
2830 baseDir ,
@@ -34,6 +36,7 @@ export async function compileOpenNextConfig(
3436 sourcePath ,
3537 buildDir ,
3638 nodeExternals . split ( "," ) ,
39+ dev ,
3740 ) ;
3841
3942 // On Windows, we need to use file:// protocol to load the config file using import()
@@ -69,10 +72,16 @@ export function compileOpenNextConfigNode(
6972 sourcePath : string ,
7073 outputDir : string ,
7174 externals : string [ ] ,
75+ dev = false ,
7276) {
7377 const outputPath = path . join ( outputDir , "open-next.config.mjs" ) ;
7478 logger . debug ( "Compiling open-next.config.ts for Node." , outputPath ) ;
7579
80+ if ( dev ) {
81+ buildDevConfig ( outputPath , externals ) ;
82+ return outputPath ;
83+ }
84+
7685 //Check if open-next.config.ts exists
7786 if ( ! fs . existsSync ( sourcePath ) ) {
7887 //Create a simple open-next.config.mjs file
0 commit comments