@@ -20,7 +20,7 @@ import {
2020 resolveBuildOutputPaths ,
2121 SERVER_FUNCTION_TRANSFORM_RUNTIME ,
2222} from "@evjs/ev/_internal/build" ;
23- import type { ResolvedConfig } from "@evjs/ev/config" ;
23+ import type { BrowserToTerminal , ResolvedConfig } from "@evjs/ev/config" ;
2424import type { ConfigureBundlerContext , PluginHooks } from "@evjs/ev/plugin" ;
2525import { pageRoutePathToRegExp } from "@evjs/shared" ;
2626import type { BuildPlan } from "@evjs/shared/manifest" ;
@@ -41,6 +41,12 @@ const lessImplementation = require.resolve("less");
4141const lessLoader = require . resolve ( "less-loader" ) ;
4242const spaHistoryFallbackRuleIndexes = new WeakMap < ConfigComplete , number > ( ) ;
4343
44+ type UtoopackDevServerConfigWithBrowserLogs = NonNullable <
45+ ConfigComplete [ "devServer" ]
46+ > & {
47+ browserToTerminal ?: BrowserToTerminal ;
48+ } ;
49+
4450export function getSpaHistoryFallbackRuleIndex (
4551 config : ConfigComplete ,
4652) : number | undefined {
@@ -118,6 +124,16 @@ export async function createUtoopackConfig(
118124 const outputPaths = resolveBuildOutputPaths ( cwd , plan ) ;
119125 await assertSafeBuildOutputPaths ( cwd , outputPaths ) ;
120126
127+ const devServerConfig : UtoopackDevServerConfigWithBrowserLogs = {
128+ hot : true ,
129+ port : config . dev . port ,
130+ https : config . dev . https !== false ,
131+ proxy : devProxy ,
132+ ...( ! isProduction
133+ ? { browserToTerminal : config . logging . browserToTerminal }
134+ : { } ) ,
135+ } ;
136+
121137 const utoopackConfig : ConfigComplete = {
122138 mode,
123139 ...( isProduction && config . target !== undefined && clientEntries . length > 0
@@ -209,12 +225,7 @@ export async function createUtoopackConfig(
209225 : { } ) ,
210226
211227 // Dev server configuration
212- devServer : {
213- hot : true ,
214- port : config . dev . port ,
215- https : config . dev . https !== false ,
216- proxy : devProxy ,
217- } ,
228+ devServer : devServerConfig ,
218229 } ;
219230 const frameworkExpectation =
220231 snapshotUtoopackFrameworkExpectation ( utoopackConfig ) ;
0 commit comments