Skip to content

Commit 6b19154

Browse files
Merge pull request #76 from alan-agius4/fix-writefiles-sync
fix: use fs sync method to write files
2 parents cffa93f + fa1d273 commit 6b19154

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ module.exports = class SpeedMeasurePlugin {
140140
chalk.enabled = true;
141141
if (outputToFile) {
142142
const writeMethod = fs.existsSync(this.options.outputTarget)
143-
? fs.appendFile
144-
: fs.writeFile;
145-
writeMethod(this.options.outputTarget, output + "\n", err => {
146-
if (err) throw err;
147-
console.log(
148-
smpTag() + "Outputted timing info to " + this.options.outputTarget
149-
);
150-
});
143+
? fs.appendFileSync
144+
: fs.writeFileSync;
145+
writeMethod(this.options.outputTarget, output + "\n");
146+
console.log(
147+
smpTag() + "Outputted timing info to " + this.options.outputTarget
148+
);
151149
} else {
152150
const outputFunc = this.options.outputTarget || console.log;
153151
outputFunc(output);

0 commit comments

Comments
 (0)