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

build fails when trailingSlash is false #212

Closed
s-kris opened this issue Jun 11, 2022 · 0 comments · Fixed by #213 or #214
Closed

build fails when trailingSlash is false #212

s-kris opened this issue Jun 11, 2022 · 0 comments · Fixed by #213 or #214

Comments

@s-kris
Copy link

s-kris commented Jun 11, 2022

bug

build fails when trailingSlash is false (#100)

error

[ERROR] Unable to build website for locale en.
[ERROR] Error: ENOENT: no such file or directory, open '/Users/<path>/build/.html'
error Command failed with exit code 1.

more context

docsRouteBasePath:"/"

setting trailingSlash:false and not setting docsRouteBasePath: "/" => build success but search-index.json is NOT generated
setting trailingSlash:false and setting docsRouteBasePath: "/" => build fails
not setting trailingSlash:false and setting docsRouteBasePath: "/" => build success and search-index.json is generated

Config

docusaurus.config.js

// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: 'name',
  tagline: 'tagline',
  url: '********',
  baseUrl: '/docs/',
  onBrokenLinks: 'warn',
  onBrokenMarkdownLinks: 'warn',
  trailingSlash: false,
  presets: [
    [
      'classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          routeBasePath: '/',
          sidebarPath: require.resolve('./sidebars.js'),
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
        blog:false,
      }),
    ],
  ],

  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      colorMode: {
        defaultMode: 'light',
        disableSwitch: true,
        respectPrefersColorScheme: false,
      },
      navbar: {
    
        items: [
          {
            type: 'doc',
            docId: 'get-started/welcome',
            position: 'left',
            label: 'Docs',
          },
          // {to: '/blog', label: 'Blog', position: 'left'},
        ],
      },
      footer: {
        style: 'dark',
        links: [
          {
            title: 'Docs',
            items: [
              // {
              //   label: 'Tutorial',
              //   to: '/docs/intro',
              // },
            ],
          },
          {
            title: 'Community',
            items: [
              {
                label: 'Stack Overflow',
                href: 'https://stackoverflow.com/questions/tagged/docusaurus',
              },
              {
                label: 'Discord',
                href: 'https://discordapp.com/invite/docusaurus',
              },
              {
                label: 'Twitter',
                href: 'https://twitter.com/docusaurus',
              },
            ],
          },
          {
            title: 'More',
            items: [
              // {
              //   label: 'Blog',
              //   to: '/blog',
              // },
              {
                label: 'GitHub',
                href: 'https://github.com/facebook/docusaurus',
              },
            ],
          },
        ],
        copyright: `Copyright © ${new Date().getFullYear()} Superblog. Built with Docusaurus.`,
      },
      prism: {
        theme: lightCodeTheme,
        darkTheme: darkCodeTheme,
      },
    }),
    themes: [
      [
        require.resolve("@easyops-cn/docusaurus-search-local"),
        {
          hashed: true,
          indexBlog: false,
          docsRouteBasePath:"/"
        },
      ],
    ],
};

module.exports = config;

versions:

 "dependencies": {
    "@docusaurus/core": "2.0.0-beta.21",
    "@docusaurus/preset-classic": "2.0.0-beta.21",
    "@easyops-cn/docusaurus-search-local": "^0.27.0",
    "@mdx-js/react": "^1.6.22",
    "clsx": "^1.1.1",
    "prism-react-renderer": "^1.3.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  },
  "devDependencies": {
    "@docusaurus/module-type-aliases": "2.0.0-beta.21",
    "@tsconfig/docusaurus": "^1.0.5",
    "typescript": "^4.6.4"
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant