From 35962a47b680c9c7d733de1852a7f12ae83c2350 Mon Sep 17 00:00:00 2001 From: Thomas Urban Date: Sun, 3 Oct 2021 17:32:45 +0200 Subject: [PATCH] fix: load site config from config.cjs if available --- packages/@vuepress/core/lib/node/loadConfig.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/@vuepress/core/lib/node/loadConfig.js b/packages/@vuepress/core/lib/node/loadConfig.js index c786e88d44..ec8b5f8459 100644 --- a/packages/@vuepress/core/lib/node/loadConfig.js +++ b/packages/@vuepress/core/lib/node/loadConfig.js @@ -14,6 +14,7 @@ const tomlParser = require('toml') module.exports = function loadConfig (vuepressDir, bustCache = true) { const configPath = path.resolve(vuepressDir, 'config.js') + const configCjsPath = path.resolve(vuepressDir, 'config.cjs') const configYmlPath = path.resolve(vuepressDir, 'config.yml') const configTomlPath = path.resolve(vuepressDir, 'config.toml') @@ -29,6 +30,8 @@ module.exports = function loadConfig (vuepressDir, bustCache = true) { siteConfig = parseConfig(configTomlPath) } else if (fs.existsSync(configPath)) { siteConfig = require(configPath) + } else if (fs.existsSync(configCjsPath)) { + siteConfig = require(configCjsPath) } return siteConfig