From 7e3020ce2f5dd5f415cfbeedd1a245ac6ad76fa7 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Mon, 11 Feb 2019 18:04:11 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B4=D0=B5=D0=BF=D0=BB=D0=BE?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/webpack.prod.config.js | 2 +- server/index.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build/webpack.prod.config.js b/build/webpack.prod.config.js index 15ec32ba..cfc04abc 100644 --- a/build/webpack.prod.config.js +++ b/build/webpack.prod.config.js @@ -16,7 +16,7 @@ const clientDir = path.resolve(__dirname, '../client'); module.exports = merge(baseWpConfig, { mode: 'production', output: { - path: `${publicDir}/app`, + path: `${publicDir}/app_new`, filename: 'bundle.[contenthash].js' }, module: { diff --git a/server/index.js b/server/index.js index ff7157a2..fcb697e1 100644 --- a/server/index.js +++ b/server/index.js @@ -16,6 +16,13 @@ async function init() { await fs.ensureDir(config.uploadDir); await fs.ensureDir(config.tempDir); await fs.emptyDir(config.tempDir); + + const appDir = `${config.publicDir}/app`; + const appNewDir = `${config.publicDir}/app_new`; + if (await fs.pathExists(appNewDir)) { + await fs.remove(appDir); + await fs.move(appNewDir, appDir); + } } async function main() {