diff --git a/packages/@vuepress/core/lib/build.js b/packages/@vuepress/core/lib/build.js index 483eca5405..f89ec16b6d 100644 --- a/packages/@vuepress/core/lib/build.js +++ b/packages/@vuepress/core/lib/build.js @@ -22,11 +22,11 @@ module.exports = async function build (sourceDir, cliOptions = {}) { } const { outDir } = options - if (path.resolve() === outDir) { + if (process.cwd() === outDir) { return console.error(logger.error(chalk.red('Unexpected option: outDir cannot be set to the current working directory.\n'), false)) } await fs.remove(outDir) - logger.debug('Dist directory: ' + chalk.gray(path.resolve(outDir))) + logger.debug('Dist directory: ' + chalk.gray(path.resolve(process.cwd(), outDir))) let clientConfig = createClientConfig(options, cliOptions).toConfig() let serverConfig = createServerConfig(options, cliOptions).toConfig() diff --git a/packages/@vuepress/core/lib/prepare/AppContext.js b/packages/@vuepress/core/lib/prepare/AppContext.js index f22a2c894a..e36ae8e0a7 100644 --- a/packages/@vuepress/core/lib/prepare/AppContext.js +++ b/packages/@vuepress/core/lib/prepare/AppContext.js @@ -52,7 +52,7 @@ module.exports = class AppContext { this.base = this.siteConfig.base || '/' this.themeConfig = this.siteConfig.themeConfig || {} this.outDir = this.siteConfig.dest - ? path.resolve(this.siteConfig.dest) + ? path.resolve(process.cwd(), this.siteConfig.dest) : path.resolve(sourceDir, '.vuepress/dist') this.pluginAPI = new PluginAPI(this)