@@ -129,23 +129,23 @@ class Server {
129
129
addAdditionalEntries ( compiler ) {
130
130
const additionalEntries = [ ] ;
131
131
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 ) ;
145
144
146
145
// 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 ) {
149
149
const searchParams = new URLSearchParams ( ) ;
150
150
151
151
/** @type {"ws:" | "wss:" | "http:" | "https:" | "auto:" } */
@@ -258,11 +258,8 @@ class Server {
258
258
searchParams . set ( "logging" , this . options . client . logging ) ;
259
259
}
260
260
261
- return searchParams . toString ( ) ;
262
- } ;
263
- const webSocketURL = this . options . webSocketServer
264
- ? getWebSocketURL ( )
265
- : "" ;
261
+ webSocketURL = searchParams . toString ( ) ;
262
+ }
266
263
267
264
additionalEntries . push (
268
265
`${ require . resolve ( "../client/index.js" ) } ?${ webSocketURL } `
0 commit comments