docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

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

Open jarhodes314 opened this issue 2 years ago • 3 comments

Have you read the Contributing Guidelines on issues?

Prerequisites

  • [X] I'm using the latest version of Docusaurus.
  • [X] I have tried the npm run clear or yarn clear command.
  • [X] I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • [X] I have tried creating a repro with https://new.docusaurus.io.
  • [X] 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 avatar Dec 21 '23 12:12 jarhodes314

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.

Josh-Cena avatar Dec 23 '23 12:12 Josh-Cena

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.

jarhodes314 avatar Dec 23 '23 13:12 jarhodes314

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.

Josh-Cena avatar Dec 23 '23 14:12 Josh-Cena