From 0bb85a4d866539aa4187680159f0c691e40cde0d Mon Sep 17 00:00:00 2001 From: Sun Haoran Date: Wed, 27 Nov 2019 15:26:38 +0800 Subject: [PATCH] fix($core): temp option in siteConfig has not effect (fix #2038) (#2040) --- packages/@vuepress/core/lib/node/App.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js index 46d6b0914b..2a6cdc261b 100755 --- a/packages/@vuepress/core/lib/node/App.js +++ b/packages/@vuepress/core/lib/node/App.js @@ -46,10 +46,6 @@ module.exports = class App { logger.warn(`Source directory doesn't exist: ${chalk.yellow(this.sourceDir)}`) } - const { tempPath, writeTemp } = createTemp(options.temp) - this.tempPath = tempPath - this.writeTemp = writeTemp - this.vuepressDir = path.resolve(this.sourceDir, '.vuepress') this.libDir = path.join(__dirname, '../') } @@ -78,10 +74,18 @@ module.exports = class App { this.base = this.siteConfig.base || '/' this.themeConfig = this.siteConfig.themeConfig || {} + // resolve tempPath + const rawTemp = this.options.temp || this.siteConfig.temp + const { tempPath, writeTemp } = createTemp(rawTemp) + this.tempPath = tempPath + this.writeTemp = writeTemp + + // resolve outDir const rawOutDir = this.options.dest || this.siteConfig.dest this.outDir = rawOutDir ? require('path').resolve(this.cwd, rawOutDir) : require('path').resolve(this.sourceDir, '.vuepress/dist') + this.pages = [] // Array this.pluginAPI = new PluginAPI(this) this.ClientComputedMixinConstructor = ClientComputedMixin(this.getSiteData())