You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fails: Cannot read property 'address' of undefined
// webpack.config.jsmodule.exports={devServer: {port: 9001,host: '0.0.0.0',before(app,server){constport=server.listeningApp.address().port;console.log('Listening on port:',port);},},// ...};
Yes, in this simplistic example, I recognize that I could hard code or add a variable port that is shared between the devServer configuration object and my before function. However I'm trying to support other cases where this is not practical.
#476 Almost addressed this, however creating the server instance is not controllable in the features list and is always done last.
I think it would be a relatively small change in the startup sequence to add creating the server to the features list and allowing it to be controlled. I don't see how it would affect other parts of the code. If this change is undesirable, I still have a workaround that works for me but I bet others might like this change aswell.
Workaround
Use setImmediate() to delay execution inside before function. This happens to work for my particular use case but this introduces other annoyances.
// webpack.config.jsmodule.exports={devServer: {port: 9001,host: '0.0.0.0',before(app,server){setImmediate(()=>{constport=server.listeningApp.address().port;console.log('Listening on port:',port);});},},// ...};
The text was updated successfully, but these errors were encountered:
Windows 10
v8.11.2
5.6.0
4.25.1
3.1.10
Code
Fails:
Cannot read property 'address' of undefined
Yes, in this simplistic example, I recognize that I could hard code or add a variable
port
that is shared between thedevServer
configuration object and mybefore
function. However I'm trying to support other cases where this is not practical.Problem
listeningApp
is set afterbefore
function is executed.#476 Almost addressed this, however creating the server instance is not controllable in the
features
list and is always done last.I think it would be a relatively small change in the startup sequence to add creating the server to the
features
list and allowing it to be controlled. I don't see how it would affect other parts of the code. If this change is undesirable, I still have a workaround that works for me but I bet others might like this change aswell.Workaround
Use
setImmediate()
to delay execution insidebefore
function. This happens to work for my particular use case but this introduces other annoyances.The text was updated successfully, but these errors were encountered: