Skip to content

Commit b35bb0f

Browse files
committed
fix: fs.promises.stat replace with promisify(fs.stat)
1 parent 22a242e commit b35bb0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
const { spawn } = require('child_process');
22
const fs = require('fs');
3+
const util = require("util");
34
const path = require('path');
45
const commandExistsSync = require('command-exists').sync;
56
const chalk = require('chalk');
67
const Watchpack = require('watchpack');
78
const which = require('which');
89
const { homedir } = require('os');
910

11+
const stat = util.promisify(fs.stat);
12+
1013
const error = msg => console.error(chalk.bold.red(msg));
1114
let info = msg => console.log(chalk.bold.blue(msg));
1215

@@ -150,7 +153,7 @@ class WasmPackPlugin {
150153
_compile(watching) {
151154
info(`ℹ️ Compiling your crate in ${this.isDebug ? 'development' : 'release'} mode...\n`);
152155

153-
return fs.promises.stat(this.crateDirectory).then(stats => {
156+
return stat(this.crateDirectory).then(stats => {
154157
if (!stats.isDirectory()) {
155158
throw new Error(`${this.crateDirectory} is not a directory`);
156159
}

0 commit comments

Comments
 (0)