docs build error: ReferenceError: document is not defined
See original GitHub issueTracking 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:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Thanks, fixed by https://github.com/cdmoro/bootstrap-vue-3/pull/305 Newest docs are now at https://cdmoro.github.io/bootstrap-vue-3/components/