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

ID's don't seem to propagate? #3789

Closed
rolandpeelen opened this issue Nov 20, 2020 · 4 comments
Closed

ID's don't seem to propagate? #3789

rolandpeelen opened this issue Nov 20, 2020 · 4 comments
Labels
closed: question This issue is a user error/misunderstanding.

Comments

@rolandpeelen
Copy link

🐛 Bug Report

When adding @docusaurus/preset-classic multiple times, there is an error the id=default is used twice. Even when manually specifying another id.

It looks to me that the preset-classic is not propagating the id properly.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

Add the following to your config;

module.exports = {
  ...someConfig,
  presets: [
    [
      require.resolve("@docusaurus/preset-classic"),
      {
        id: "a",
        docs: {
          path: "a",
          routeBasePath: "a",
          sidebarPath: require.resolve("./someSidebar.js"),
        }
    ],
    [
      require.resolve("@docusaurus/preset-classic"),
      {
        id: "a",
        docs: {
          path: "a",
          routeBasePath: "a",
          sidebarPath: require.resolve("./someSidebar.js"),
        }
      }
    ]
  ]
};

Expected behavior

I would expect it to compile with the id tag there.

Actual Behavior

We get the following error (I changed paths to path/x

Error: Plugin docusaurus-theme-search-algolia is used 2 times with id=default.
To use the same plugin multiple times on a Docusaurus site, you need to assign a unique id to each plugin instance.
    at /path/x/node_modules/@docusaurus/core/lib/server/plugins/pluginIds.js:20:23
    at Array.forEach (<anonymous>)
    at /path/x/node_modules/@docusaurus/core/lib/server/plugins/pluginIds.js:18:45
    at Array.forEach (<anonymous>)
    at Object.ensureUniquePluginInstanceIds (/path/x/node_modules/@docusaurus/core/lib/server/plugins/pluginIds.js:16:35)
    at Object.initPlugins [as default] (/path/x/node_modules/@docusaurus/core/lib/server/plugins/init.js:75:17)
    at Object.loadPlugins (/path/x/node_modules/@docusaurus/core/lib/server/plugins/index.js:49:35)
    at Object.load (/path/x/node_modules/@docusaurus/core/lib/server/index.js:81:74)
    at start (/path/x/node_modules/@docusaurus/core/lib/commands/start.js:36:34)
    at /path/x/node_modules/@docusaurus/core/bin/docusaurus.js:74:5
    at Command.<anonymous> (/path/x/node_modules/@docusaurus/core/bin/docusaurus.js:153:23)
    at Command.listener (/path/x/node_modules/@docusaurus/core/node_modules/commander/index.js:370:29)
    at Command.emit (events.js:315:20)
    at Command.parseArgs (/path/x/node_modules/@docusaurus/core/node_modules/commander/index.js:892:12)
    at Command.parse (/path/x/node_modules/@docusaurus/core/node_modules/commander/index.js:642:21)
    at Object.<anonymous> (/path/x/node_modules/@docusaurus/core/bin/docusaurus.js:214:5)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.68
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node v12.18.0
  • Operating system and version (desktop or mobile): MacOS 10.15

...

I'll try and create a working reproduction in a public git repo.

@rolandpeelen rolandpeelen added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 20, 2020
@slorber
Copy link
Collaborator

slorber commented Nov 20, 2020

Hi,

Presets are a composition of multiple plugins and a theme, they are not really meant to be used twice per project (if it was the case, you'd have to provide an id for each plugin of the preset, not just the docs plugin)

What is the purpose of using it twice?
What result do you want?

@slorber slorber closed this as completed Nov 20, 2020
@rolandpeelen
Copy link
Author

@slorber - Thanks for getting back to me so quickly! Perhaps we're just setting our stuff up wrong. But basically, we want to run two documentation pages. We're currently doing it but we're on an older alpha. Upgrading broke this for us.

See: https://docs.tenzir.com/

Any idea how we could set this up differently so we would have similar results?

@slorber
Copy link
Collaborator

slorber commented Nov 20, 2020

Do you have a public repo for that site?

Which version are you using, and why upgrading is broken exactly?

Docs multi-instance plugin is a pretty new feature from this summer, still not very well documented (#3299)

You'd rather just add an extra @docusaurus/plugin-content-docs rather than an extra classic preset, because you don't want. to have twice the classic theme, the blog etc...

Docs multi-instance is mostly for versioned sites, where versioning of 2 projects can be different.
If you don't use versioning maybe you can just have 1 docs plugin instance, but use 2 sidebars

@rolandpeelen
Copy link
Author

@slorber

Thanks for getting back to me. It looks like the link to multi-instance stuff is working! Thanks!

@Josh-Cena Josh-Cena added closed: question This issue is a user error/misunderstanding. and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question This issue is a user error/misunderstanding.
Projects
None yet
Development

No branches or pull requests

3 participants