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() {