Cli/server: Fix webpack deprecation warnings

Running the development dev server results in the following deprecation
warnings from "webpack-dev-server".

* [DEP_WEBPACK_DEV_SERVER_CONSTRUCTOR] DeprecationWarning: Using 'compiler'
as the first argument is deprecated. Please use 'options' as the first
argument and 'compiler' as the second argument.
* [DEP_WEBPACK_DEV_SERVER_LISTEN] DeprecationWarning: 'listen' is deprecated.
Please use the async 'start' or 'startCallback' method.

Signed-off-by: Niklas Aronsson <niklasar@axis.com>
This commit is contained in:
Niklas Aronsson
2022-04-07 15:32:33 +02:00
parent fe391c8bb4
commit d2256c0384
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Fix `webpack-dev-server` deprecations.
+2 -2
View File
@@ -43,7 +43,6 @@ export async function serveBundle(options: ServeOptions) {
const compiler = webpack(config);
const server = new WebpackDevServer(
compiler as any,
{
hot: !process.env.CI,
devMiddleware: {
@@ -71,10 +70,11 @@ export async function serveBundle(options: ServeOptions) {
webSocketURL: 'auto://0.0.0.0:0/ws',
},
} as any,
compiler as any,
);
await new Promise<void>((resolve, reject) => {
server.listen(port, host, (err?: Error) => {
server.startCallback((err?: Error) => {
if (err) {
reject(err);
return;