How does webpack-dev-server call back after initialization is complete?

  node.js, question

NodeJS creates a thread to run webpack-dev-server, but how should the callback be made after the service initialization is completed?

I run webpack-dev-middleware through node, in middleware
The compiler.plugin(“done “) function executes the callback array I registered inside
Add a variable to this plug-in to hold the function you need to call back.
webpackDevMiddleware.hooks=[];

webpackDevMiddleware.hook=function(hook) {
webpackDevMiddleware.hooks.push(hook);
};

Then every time the bundle completes, it passes through the body of done’s function, and you call back at this time.