typesense / typesense/docusaurus-theme-search-typesense

Build fails when config includes redocusaurus and docusaurus-theme-search-typesense

Open
#23 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
84
Forks
24
Avg merge
1m
Merged PRs (30d)
1

Description

Description

Hi

I'm getting a build error when I compile with 2 plugins in the same config

  • redocusaurus 1.3.0
  • docusaurus-theme-search-typesense 0.7.0-0

I also wanted to note that I only run into this error when running npm run build if i do npm start everything works fine with both plugins available in the docusaurus config.

I've tried a mix of the following

  • rm -rf node_modules package-lock.json and reinstall
  • downgrading docusaurus to v2.0.1
  • upgrading to docusaurus v2.1.0

I've noticed that if I were to comment out the redocusaurus config in presets of docusaurus.config.js OR themes:['docusaurus-theme-search-typesense'] the build happens smoothly

docusaurus.config.js

  presets: [
    [
      '@docusaurus/preset-classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
        },
        blog: false,
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      }),
    ],
    [
      'redocusaurus',
      {
        specs: [
          {
            spec: require.resolve('./static/api_spec/open-api-spec.yml'),
            route: '/api',
          },
        ],
        theme: {
          primaryColor: '#2e8555',
          primaryColorDark: '#25c2a0'
        },
      },
    ],
  ],
  themes: ['docusaurus-theme-search-typesense'],

package.json

{
  "name": "json-api-docs",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "docusaurus": "docusaurus",
    "start": "docusaurus start",
    "build": "docusaurus build",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy",
    "clear": "docusaurus clear",
    "serve": "docusaurus serve",
    "write-translations": "docusaurus write-translations",
    "write-heading-ids": "docusaurus write-heading-ids",
    "typecheck": "tsc"
  },
  "dependencies": {
    "@docusaurus/core": "^2.1.0",
    "@docusaurus/preset-classic": "^2.1.0",
    "@mdx-js/react": "^1.6.22",
    "clsx": "^1.2.1",
    "docusaurus-theme-search-typesense": "^0.7.0-0",
    "prism-react-renderer": "^1.3.5",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "redocusaurus": "^1.3.0"
  },
  "devDependencies": {
    "@docusaurus/module-type-aliases": "^2.1.0",
    "@tsconfig/docusaurus": "^1.0.5",
    "typescript": "^4.7.4"
  },
  "browserslist": {
    "production": [
      ">0.5%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "engines": {
    "node": ">=16.14"
  }
}

error message

[INFO] [en] Creating an optimized production build...
✔ Client
✖ Server
  Compiled with some errors in 15.89s

main:55529
                {}.DEBUG = namespaces;
                  ^

SyntaxError: Unexpected token '.'
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
    at .../json-api-docs/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24
    at .../json-api-docs/node_modules/webpack/lib/MultiCompiler.js:554:14
    at processQueueWorker (.../json-api-docs/node_modules/webpack/lib/MultiCompiler.js:491:6)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
[INFO] Docusaurus version: 2.1.0
Node version: v16.14.2

Steps to reproduce

  • implement redocusaurus
  • implement searchbar utilizing typesense
  • npm run build with both redocusaurus and docusaurus-theme-search-typesense enabled in the docusaurus config

Expected Behavior

  • I would expect the build to be successful / compete

Actual Behavior

  • Build fails when compiling the "server"

Metadata

Typsense Version:
0.7.0-0

OS:
MacOS Monterey 12.6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docusaurus.config.js and package.json, then reproduce with npm run build using both redocusaurus and docusaurus-theme-search-typesense enabled. Compare the server compilation output with each plugin disabled and investigate the reported error in the generated webpack build. Done means the production build completes with both plugins enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, webpack
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.