Skip to content

BModal creates ReferenceError: document is not defined in nuxt #2736

Closed
@sebbayer

Description

@sebbayer

Describe the bug

Simply add a BModal to a component in a nuxt environment. This line in the BModal source will lead to an error 500 during SSR.

const defaultModalDialogZIndex = ref(getModalZIndex(element.value ?? document.body))

ReferenceError: document is not defined

You can see the same error in console when you run the build task of this repository.

Reproduction

https://stackblitz.com/edit/nuxt-starter-etta1mtk?file=app.vue

Used Package Manager

pnpm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions