rohit-gohri / redocusaurus

OpenAPI for Docusaurus with Redoc
https://redocusaurus.vercel.app/
MIT License
642 stars 115 forks source link

TypeError: Cannot read properties of undefined (reading 'tokenizePlaceholders') with `swcJsLoader: true,` #388

Open thde opened 8 hours ago

thde commented 8 hours ago

As v2.2.0 has been released with support for @docusaurus/faster, I tried to enable it for our repository, but it fails with the following error if swcJsLoader: true, is enabled:

TypeError: Cannot read properties of undefined (reading 'tokenizePlaceholders')

It's not clear to me if the issue is at redocusaurus'es side or on the side of docusaurus.

The Spec can be found here. The full stack trace looks like this:

[ERROR] Error: Unable to build website for locale en.
    at tryToBuildLocale (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:78:15)
    at async ***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:34:9
    at async mapAsyncSequential (***/docs.nine.ch/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
    at async Command.build (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:33:5) {
  [cause]: Error: Docusaurus static site generation failed for 1 paths:
  - "/api/"
      at generateStaticFiles (***/docs.nine.ch/node_modules/@docusaurus/core/lib/ssg/ssg.js:129:15)
      at async executeSSG (***/docs.nine.ch/node_modules/@docusaurus/core/lib/ssg/ssgExecutor.js:29:23)
      ... 6 lines matching cause stack trace ...
      at async Command.build (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:33:5) {
    [cause]: AggregateError
        at generateStaticFiles (***/docs.nine.ch/node_modules/@docusaurus/core/lib/ssg/ssg.js:130:20)
        at async executeSSG (***/docs.nine.ch/node_modules/@docusaurus/core/lib/ssg/ssgExecutor.js:29:23)
        at async buildLocale (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/buildLocale.js:60:31)
        at async runBuildLocaleTask (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:93:5)
        at async ***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:74:13
        at async tryToBuildLocale (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:70:9)
        at async ***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:34:9
        at async mapAsyncSequential (***/docs.nine.ch/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
        at async Command.build (***/docs.nine.ch/node_modules/@docusaurus/core/lib/commands/build/build.js:33:5) {
      [errors]: [
        Error: Can't render static file for pathname "/api/"
            at generateStaticFile (***/docs.nine.ch/node_modules/@docusaurus/core/lib/ssg/ssg.js:167:15)
            at processTicksAndRejections (node:internal/process/task_queues:105:5)
            at runNextTicks (node:internal/process/task_queues:69:3)
            at process.processImmediate (node:internal/timers:459:9)
            at async ***/docs.nine.ch/node_modules/p-map/index.js:57:22 {
          [cause]: TypeError: Cannot read properties of undefined (reading 'tokenizePlaceholders')
          Please report this to https://github.com/markedjs/marked.
              at ***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:49942:40
              at Object.run (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:50972:6)
              at Object.highlight (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:50881:12)
              at jt (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:11348)
              at Object.highlight (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:52821)
              at Er.code (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:41553)
              at Sr.parse (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:44695)
              at parse (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:43979)
              at ***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:49196
              at Ar (***/docs.nine.ch/build/__server/assets/js/f0ad3fbb.0f5fb192.js:52600:49316)
        }
      ]
    }
  }
}
rohit-gohri commented 8 hours ago

It's not clear to me if the issue is at redocusaurus'es side or on the side of docusaurus.

Might be worth reporting it there too (you can link this issue), since it's still experimental and your normal build works (I guess?)

thde commented 4 hours ago

Yeah, makes sense. Will do 👍🏼