Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #2466 load site config from config.cjs if available #2933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/@vuepress/core/lib/node/loadConfig.js
Expand Up @@ -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')

Expand All @@ -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
Expand Down