(compiler, port, bindIp, longTermCaching, httpsOptions)
| 175 | // must have been configured correctly for hot reloading. returns an object with |
| 176 | // two properties, started and stop; see the default function doc for explanation. |
| 177 | const startHotLoadJsServer = (compiler, port, bindIp, longTermCaching, httpsOptions) => { |
| 178 | logger.info("Starting hot reload JavaScript server..."); |
| 179 | const compiledPromise = new Promise((resolve) => compiler.plugin("done", () => resolve())); |
| 180 | const jsServer = new WebpackDevServer(compiler, { |
| 181 | noInfo: true, |
| 182 | hot: true, |
| 183 | headers: { 'Access-Control-Allow-Origin': '*' }, |
| 184 | https: !!httpsOptions, |
| 185 | key: httpsOptions ? httpsOptions.key : undefined, |
| 186 | cert: httpsOptions ? httpsOptions.cert : undefined, |
| 187 | ca: httpsOptions ? httpsOptions.ca : undefined, |
| 188 | }); |
| 189 | const serverStartedPromise = new Promise((resolve, reject) => { |
| 190 | jsServer.listen(port, bindIp, (e) => { |
| 191 | if (e) { |
| 192 | reject(e); |
| 193 | return; |
| 194 | } |
| 195 | resolve(); |
| 196 | }); |
| 197 | }); |
| 198 | return { |
| 199 | stop: serverToStopPromise(jsServer), |
| 200 | started: Promise.all([compiledPromise, serverStartedPromise]) |
| 201 | .then(() => logger.info(`Started hot reload JavaScript server over ${httpsOptions ? "HTTPS" : "HTTP"} on ${bindIp}:${port}`)), |
| 202 | }; |
| 203 | }; |
| 204 | |
| 205 | // for when you need to run the JavaScript compiler (in order to get the chunk file |
| 206 | // names for the server routes file) but don't really want to actually up a JavaScript |
nothing calls this directly
no test coverage detected
searching dependent graphs…