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.

docs build error: ReferenceError: document is not defined

See original GitHub issue

Tracking here. Fixes are welcome. Maybe migrate from vuepress to vitepress

# build library
npm run build

# docs
cd docs
npm install
cd ..
npm run docs:build

# navigate into the build output directory
cd docs/.vuepress/dist

gives

 Compiling with vite - done
✖ Rendering pages - failed
ReferenceError: document is not defined
    at enableDismissTrigger (/home/marius/work/bootstrap-vue-3/docs/node_modules/bootstrap/dist/js/bootstrap.js:761:21)
    at /home/marius/work/bootstrap-vue-3/docs/node_modules/bootstrap/dist/js/bootstrap.js:856:3
    at /home/marius/work/bootstrap-vue-3/docs/node_modules/bootstrap/dist/js/bootstrap.js:7:83
    at Object.<anonymous> (/home/marius/work/bootstrap-vue-3/docs/node_modules/bootstrap/dist/js/bootstrap.js:10:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cdmorocommented, Mar 4, 2022

This type of error happens because bootstrap is not SSR friendly. Every time you use a component you have to wrap it inside a ClientOnly tag. We have to check all of the markdown files if we missing something.

I’m not sure if migrating to Vitepress solves the problem. Besides, Vitepress is less customizable than Vuepress.

0reactions
mariusacommented, Mar 5, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: document is not defined in JavaScript
To solve the"ReferenceError: document is not defined" error, make sure to only use the document global variable on the browser. The variable relates...
Read more >
ReferenceError: document is not defined (in plain JavaScript)
Explanation: The error is caused because NextJs renders the page in the server only and in the server document (document is used inside...
Read more >
How to solve the document is not defined error - Flavio Copes
Here's how to fix the “referenceerror: document is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >
How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >
ReferenceError: document is not defined in JavaScript
The "ReferenceError: document is not defined" error is thrown when the code tries to access the document object, but the object is not ......
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