@@ -129,23 +129,23 @@ class Server {
129129 addAdditionalEntries ( compiler ) {
130130 const additionalEntries = [ ] ;
131131
132- const isWebTarget = ( compilerOptions ) =>
133- compilerOptions . externalsPresets
134- ? compilerOptions . externalsPresets . web
135- : [
136- "web" ,
137- "webworker" ,
138- "electron-preload" ,
139- "electron-renderer" ,
140- "node-webkit" ,
141- // eslint-disable-next-line no-undefined
142- undefined ,
143- null ,
144- ] . includes ( compilerOptions . target ) ;
132+ const isWebTarget = compiler . options . externalsPresets
133+ ? compiler . options . externalsPresets . web
134+ : [
135+ "web" ,
136+ "webworker" ,
137+ "electron-preload" ,
138+ "electron-renderer" ,
139+ "node-webkit" ,
140+ // eslint-disable-next-line no-undefined
141+ undefined ,
142+ null ,
143+ ] . includes ( compiler . options . target ) ;
145144
146145 // TODO maybe empty empty client
147- if ( this . options . client && isWebTarget ( compiler . options ) ) {
148- const getWebSocketURL = ( ) => {
146+ if ( this . options . client && isWebTarget ) {
147+ let webSocketURL = "" ;
148+ if ( this . options . webSocketServer ) {
149149 const searchParams = new URLSearchParams ( ) ;
150150
151151 /** @type {"ws:" | "wss:" | "http:" | "https:" | "auto:" } */
@@ -258,11 +258,8 @@ class Server {
258258 searchParams . set ( "logging" , this . options . client . logging ) ;
259259 }
260260
261- return searchParams . toString ( ) ;
262- } ;
263- const webSocketURL = this . options . webSocketServer
264- ? getWebSocketURL ( )
265- : "" ;
261+ webSocketURL = searchParams . toString ( ) ;
262+ }
266263
267264 additionalEntries . push (
268265 `${ require . resolve ( "../client/index.js" ) } ?${ webSocketURL } `
0 commit comments