Skip to content
Discussion options

You must be logged in to vote

We don't support ES import statements in the config file, as we don't support ES modules yet there (but we plan to). This also means you can't use top-level await.

I'm not sure how imports are related to fetching data from a backend. 🤷‍♂️

Technically we support async config creation, see https://docusaurus.io/docs/api/docusaurus-config

module.exports = async function configCreatorAsync() {
  const {title, favicon, navbarItems} = await fetchConfigFromBackend();
  return {
    // site config...
  };
};

Now I'm not sure it's a great idea: you'd have to run this request everytime you start Docusaurus (this means you can't start Docusuaurs if you have no internet connexion, or if your backend …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SudhaM-Hexaware
Comment options

Answer selected by SudhaM-Hexaware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants