Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NickGerleman committed Nov 20, 2023
1 parent 16a4d34 commit 3fb71b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/docusaurus/src/webpack/plugins/WaitPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import {stat} from 'fs/promises';
import fs from 'fs-extra';
import type {Compiler} from 'webpack';

type WaitPluginOptions = {
Expand All @@ -25,6 +25,8 @@ export default class WaitPlugin {
}
}

// This is a re-implementation of the algorithm used by the "wait-on" package
// https://github.com/jeffbski/wait-on/blob/master/lib/wait-on.js#L200
async function waitOn(filepath: string): Promise<void> {
const pollingIntervalMs = 300;
const stabilityWindowMs = 750;
Expand All @@ -35,7 +37,7 @@ async function waitOn(filepath: string): Promise<void> {
for (;;) {
let size = -1;
try {
size = (await stat(filepath)).size;
size = (await fs.stat(filepath)).size;
} catch (err) {}

if (size !== -1) {
Expand Down

0 comments on commit 3fb71b3

Please sign in to comment.