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

feat: add async load of config #1618

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/@vuepress/core/lib/node/loadConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ module.exports = function loadConfig (vuepressDir, bustCache = true) {
} else if (fs.existsSync(configTomlPath)) {
siteConfig = parseConfig(configTomlPath)
} else if (fs.existsSync(configPath)) {
siteConfig = require(configPath)
if (typeof require(configPath).then === 'function') {
siteConfig = require(configPath).then((config) => config)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you can add a catch with a pretty error message it will be good for me.

use logs in shared utils package to log the error

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @f3ltron not to much time to review and add a proper commit but updated with catch and logger.error message

} else {
siteConfig = require(configPath)
}
}

return siteConfig
}

Expand Down