Skip to content

I can't use it with Docusaurus v2 #69

@seyoon20087

Description

@seyoon20087

Environment Info:

  • npm: 7.24.0
  • yarn: 3.0.2 (berry)

Hello,

When I try to compile my Docusaurus v2 site (based on React) with your dependency, I get this error:

$ yarn run build
[en] Creating an optimized production build...
[info] [webpackbar] Compiling Client
[info] [webpackbar] Compiling Server
[success] [webpackbar] Client: Compiled successfully in 23.90s
Docusaurus Node/SSR could not render static page with path "/" because of following error:
ReferenceError: document is not defined
    at enableDismissTrigger (main:5763:19)
    at Module.9522 (main:5858:1)
    at __webpack_require__ (main:60951:42)
    at main:1596:116
Pro tip: It looks like you are using code that should run on the client-side only.
To get around it, try using <BrowserOnly> (https://docusaurus.io/docs/docusaurus-core/#browseronly) or ExecutionEnvironment (https://docusaurus.io/docs/docusaurus-core/#executionenvironment).
It might also require to wrap your client code in useEffect hook and/or import a third-party library dynamically (if any).
[success] [webpackbar] Server: Compiled with some errors in 26.57s
Error: Server-side rendering fails due to the error above.
Unable to build website for locale "en".
Error: Failed to compile with errors.
    at /builds/seyoon20087/seyoon20087-github-io/node_modules/@docusaurus/core/lib/webpack/utils.js:203:24
    at /builds/seyoon20087/seyoon20087-github-io/node_modules/webpack/lib/MultiCompiler.js:554:14
    at processQueueWorker (/builds/seyoon20087/seyoon20087-github-io/node_modules/webpack/lib/MultiCompiler.js:491:6)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

The full log is available in this gist.

If this could be resolved, it would be very helpful to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamBug or enhancement in upstream package

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions