Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont resolve promises on continuous processes #408

Merged
merged 2 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function buildNpmDependencies(): any {
}
}

async function fileWatch(config: webpack.Configuration, args: any) {
async function fileWatch(config: webpack.Configuration, args: any, shouldResolve = false) {
return new Promise<webpack.Compiler>((resolve, reject) => {
const watchOptions = config.watchOptions as webpack.Compiler.WatchOptions;
const compiler = createWatchCompiler(config);
Expand All @@ -141,13 +141,15 @@ async function fileWatch(config: webpack.Configuration, args: any) {
: 'watching...';
logger(stats.toJson({ warningsFilter }), config, runningMessage, args);
}
resolve(compiler);
if (shouldResolve) {
resolve(compiler);
}
});
});
}

async function serve(config: webpack.Configuration, args: any) {
const compiler = args.watch ? await fileWatch(config, args) : await build(config, args);
const compiler = args.watch ? await fileWatch(config, args, true) : await build(config, args);
let isHttps = false;
const base = args.base || '/';

Expand Down Expand Up @@ -265,16 +267,12 @@ async function serve(config: webpack.Configuration, args: any) {
.listen(args.port, (error: Error) => {
if (error) {
reject(error);
} else {
resolve();
}
});
} else {
app.listen(args.port, (error: Error) => {
if (error) {
reject(error);
} else {
resolve();
}
});
}
Expand Down
Loading