#document is not defined

1 messages · Page 1 of 1 (latest)

sullen sleet
#

I have created Admin in Laravel + Inertia and Vuejs. Inertia Client working fibe but when i run php artisan inertia:start-ssr it gives me error document is not define.

**php artisan inertia:start-ssr
F:\Tarun\Inertia\Velzon_Inertia\node_modules\bootstrap\dist\js\bootstrap.bundle.js:807
EventHandler.on(document, clickEvent, [data-bs-dismiss="${name}"], function (event) {
^

ReferenceError: document is not defined
at enableDismissTrigger (F:\Tarun\Inertia\Velzon_Inertia\node_modules\bootstrap\dist\js\bootstrap.bundle.js:807:21)
at F:\Tarun\Inertia\Velzon_Inertia\node_modules\bootstrap\dist\js\bootstrap.bundle.js:889:3
at F:\Tarun\Inertia\Velzon_Inertia\node_modules\bootstrap\dist\js\bootstrap.bundle.js:7:83
at Object.<anonymous> (F:\Tarun\Inertia\Velzon_Inertia\node_modules\bootstrap\dist\js\bootstrap.bundle.js:10:3)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Node.js v18.17.0**

bright brook
#

Yeah, you can't use things like window or document during SSR, because it doesn't exist in Node. So you'd either have to use something that's SSR compatible and I guess the Bootstrap version you're using isn't, or use a library to "mock" the browser