From e8dce6811a1c46a3723efc94e212cc6e395b5859 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Mon, 31 May 2021 14:09:21 +0200
Subject: [PATCH] bugfix: catch if output dir does not exist

---
 webpack/webpack.aot-common.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/webpack/webpack.aot-common.js b/webpack/webpack.aot-common.js
index 6d233d391..6c98c2f7c 100644
--- a/webpack/webpack.aot-common.js
+++ b/webpack/webpack.aot-common.js
@@ -50,9 +50,11 @@ const outputPath = path.resolve(__dirname,'../dist/aot')
 compileQuickOnePager()
   .then(html => {
     const fs = require('fs')
-    fs.writeFile(path.join(outputPath, 'quickstart.html'), html, 'utf-8', (err) => {
-      if (err) throw new Error(`quickOnePager cannot be written to disk`)
-    })
+    const { execSync } = require('child_process')
+    const { promisify } = require('util')
+    const asyncWrite = promisify(fs.writeFile)
+    execSync(`mkdir -p ${outputPath}`)
+    return asyncWrite(path.join(outputPath, 'quickstart.html'), html, 'utf-8')
   })
   .catch(e => {
     console.warn(e)
-- 
GitLab