From 47fcce0dfbde758ea297e9a257006427bfa9ec7a Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 5 Oct 2023 15:10:39 -0700 Subject: [PATCH] fix(webpack): add guard around onListening call (#19363) --- packages/webpack/src/utils/run-webpack.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/webpack/src/utils/run-webpack.ts b/packages/webpack/src/utils/run-webpack.ts index d3d9fb89e8b48..d131bc2c06870 100644 --- a/packages/webpack/src/utils/run-webpack.ts +++ b/packages/webpack/src/utils/run-webpack.ts @@ -22,7 +22,9 @@ export function runWebpackDevServer( const originalOnListen = devServerConfig.onListening; devServerConfig.onListening = function (server: any) { - originalOnListen(server); + if (typeof originalOnListen === 'function') { + originalOnListen(server); + } const devServerOptions: WebpackDevServerConfiguration = server.options;