Skip to content

Commit 2144a1b

Browse files
knagaitsevematipico
authored andcommitted
chore(serve): remove promise return from serve package (#1091)
1 parent 51831c7 commit 2144a1b

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

packages/serve/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { core } from "../../lib/utils/cli-flags";
1212
* @param {String[]} args - args processed from the CLI
1313
* @returns {Function} invokes the devServer API
1414
*/
15-
export default function serve(args): Promise<void | Function> {
15+
export default function serve(args): void {
1616
const cli = new WebpackCLI();
1717
// partial parsing usage: https://github.com/75lb/command-line-args/wiki/Partial-parsing
1818

@@ -27,9 +27,7 @@ export default function serve(args): Promise<void | Function> {
2727
if (webpackArgs && webpackArgs._all && typeof webpackArgs._all.hot !== 'undefined') {
2828
finalArgs['hot'] = webpackArgs._all.hot;
2929
}
30-
return new Promise((resolve): void => {
31-
cli.getCompiler(webpackArgs, core).then((compiler): void => {
32-
startDevServer.default(compiler, finalArgs, resolve);
33-
});
30+
cli.getCompiler(webpackArgs, core).then((compiler): void => {
31+
startDevServer.default(compiler, finalArgs);
3432
});
3533
}

packages/serve/startDevServer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import * as Server from "webpack-dev-server/lib/Server";
66
*
77
* @param {Object} compiler - a webpack compiler
88
* @param {Object} options - devServer options
9-
* @param {Function} onListening - optional callback for when the server starts listening
109
*
1110
* @returns {Void}
1211
*/
13-
export default function startDevServer(compiler, options, onListening): void {
12+
export default function startDevServer(compiler, options): void {
1413
const firstWpOpt = compiler.compilers
1514
? compiler.compilers[0].options
1615
: compiler.options;
@@ -33,8 +32,5 @@ export default function startDevServer(compiler, options, onListening): void {
3332
if (err) {
3433
throw err;
3534
}
36-
if (typeof onListening === 'function') {
37-
onListening();
38-
}
3935
});
4036
}

0 commit comments

Comments
 (0)