question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

content plugins reject options.routeBasePath = ''

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Description

When I use default preset options

module.exports = {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        pages: {
          path: 'src/pages',
          routeBasePath: '',
          include: ['**/*.{js,jsx,ts,tsx,md,mdx}'],
          exclude: [
            '**/_*.{js,jsx,ts,tsx,md,mdx}',
            '**/_*/**',
            '**/*.test.{js,jsx,ts,tsx}',
            '**/__tests__/**',
          ],
          mdxPageComponent: '@theme/MDXPage',
          remarkPlugins: [require('remark-math')],
          rehypePlugins: [],
          beforeDefaultRemarkPlugins: [],
          beforeDefaultRehypePlugins: [],
        },
      },
    ],
  ],
};

It pointed out that ValidationError: "routeBasePath" is not allowed to be empty image

Self-service

  • I’d be willing to address this documentation request myself.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Josh-Cenacommented, Nov 3, 2022

routeBasePath is somehow the “plugin baseUrl”. It made sense to me to be consistent between baseUrl and routeBasePath

Yeah, I’ll agree with that stance. Well, I’ll prefer to normalize—I know it was previously used as a “multiple root plugins” hack, which is why I don’t like ""; but if we always normalize, I do prefer the non-erroring side.

1reaction
slorbercommented, Oct 28, 2022

Frankly I don’t get the semantic difference between '/' and ''. Is the latter only useful to hack around the “multiple root plugins” issue?

I don’t even remember what this issue is exactly but I don’t think it hacks around anything if we normalize ‘’ to ‘/’ anyway.

If that’s the case I think we should continue to reject it until the actual issue is properly remedied.

‘/’ works so if we normalize ‘’ to ‘/’ there won’t be issues, it would work as if user provided “/” 🤷‍♂️

We already normalize slashes, but I don’t think we should allow empty strings unless it has clear semantics.

To me using “docs” (default plugin routeBasePath value) instead of “/docs/” is not particularly more semantically wrong than using ‘’ instead of ‘/’.


routeBasePath is somehow the “plugin baseUrl”. It made sense to me to be consistent between baseUrl and routeBasePath

Now I didn’t notice but we actually don’t accept baseUrl: '' . I thought we did normalize it to “/” already, but instead it prints an error message:

“baseUrl” is not allowed to be empty

I suggest either:

  • allow ‘’ for both baseUrl and routeBasePath, eventually emit a warning saying the value should rather be ‘/’
  • reject ‘’ for both baseUrl and routeBasePath with a clearer error message explaining to use ‘/’ instead (+ fix docs using ‘’)

The first option looks better to me, as users will intuitively try to use ‘’.

Do we want to throw on start while we could handle the bad value more gracefully?

Heck, we could even accept null/false here 🤷‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

plugin-content-docs | Docusaurus
You can configure this plugin through the preset options. ... routeBasePath, string, 'docs', URL route for the docs section of your site.
Read more >
plugins/reject-private-submit - Git at Google
This plugin will simply reject to submit (merge) any private changes. Powered by Gitiles| Privacytxt json.
Read more >
Reject bad password - WordPress.org
I have the password and confirm_password fields enabled and wish to be able to allow the user to specify a password when registering...
Read more >
WPPizza – Confirm|Reject|Notify
Any errors generated can be found in the main wppizza plugins /log directory ... (short for Confirm, Reject, Notify) to set options as...
Read more >
21.1.0 API Reference - hapi.dev
The server options control the behavior of the server object. ... Merges an object into to the existing content of server.plugins[name] where:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found