From b3dd8e2d2a67ad55099a99bc519a01a13825c64d Mon Sep 17 00:00:00 2001 From: Staffan Eketorp Date: Tue, 23 Oct 2018 12:05:17 +0200 Subject: [PATCH] Ensure directory exists before writing autoupdate_version --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b5199b5..83ac879 100644 --- a/index.js +++ b/index.js @@ -250,9 +250,11 @@ class MeteorImportsPlugin { // Also kick off an async write to the output file let outputPath = compiler.options.output.path; const outputFile = path.join(outputPath, 'autoupdate_version'); - fs.writeFile(outputFile, hash, err => { - if (err) logError('Unable to write autoupdate_version file', err); - else log('Wrote autoupdate_version file to ', outputFile); + fs.mkdir(path.dirname(outputFile), () => { + fs.writeFile(outputFile, hash, err => { + if (err) logError('Unable to write autoupdate_version file', err); + else log('Wrote autoupdate_version file to ', outputFile); + }); }); }); });