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

Plugins API: beforeDevServer and afterDevServer are documented, but don't exist #9655

Open
6 of 7 tasks
jarhodes314 opened this issue Dec 21, 2023 · 3 comments
Open
6 of 7 tasks
Labels
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

Comments

@jarhodes314
Copy link

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

https://docusaurus.io/docs/api/plugin-methods mentions beforeDevServer and afterDevServer. When I attempted to use these, I found I couldn't get them to do anything. A quick search in GitHub shows only results in .mdx files, so it appears to me like the API simply doesn't exist. Searching for configureWebpack instead, for example, brings up a bunch of results.

Reproducible demo

https://codesandbox.io/p/devbox/examples-classic-b9y9z?file=%2Fdocusaurus.config.js

Steps to reproduce

  1. Run the dev server
  2. Observe that running beforeDevServer isn't logged

Expected behavior

I don't really know because it's completely broken, but I'd expect it to at least console.log when starting the dev server, like it does if I configure the plugin manually using configureWebpack.

Actual behavior

Nothing is logged. I get no behaviour change.

Your environment

No response

Self-service

  • I'd be willing to fix this bug myself.
@jarhodes314 jarhodes314 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 Dec 21, 2023
@Josh-Cena
Copy link
Collaborator

Methods marked as // TODO means they don't exist. Looks very unprofessional to have these stubs in the official documentation, but they have been there since docusaurus had <100 users 😅

I don't think they are off anyone's roadmap, AFAICT, but we haven't seen enough motivating use cases.

@jarhodes314
Copy link
Author

I don't particularly care about the APIs in question not existing. In practice, they would have probably saved me little effort. The issue here is the total lack of communication that the wishlist embedded in the documentation is merely that.

Methods marked as // TODO means they don't exist

Why do I have to raise a GitHub issue to establish this? How am I supposed to know this? What I took these docs to mean were "methods with //TODO above them don't have a proper documentation comment". The idea TODO without any context is sufficient communication to anyone, let alone users of the product, is insane.

@Josh-Cena
Copy link
Collaborator

This entire page is not designed to be user-facing but for communication within a very small group of developers who both develop and consume the plugin APIs. Time has evolved and the audience has changed but the page is not updated. Therefore you are criticizing what is essentially an internal documentation page. I'm not saying it shouldn't be updated, just that no effort has been done and it served its purpose at its time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

No branches or pull requests

2 participants