Next.js (13.2.3) - bootstrap@5.3.0-alpha1: Uncaught TypeError: Cannot read properties of undefined (reading 'backdrop')
Prerequisites
-
I have searched for duplicate or closed issues -
I have validated any HTML to avoid common problems -
I have read the contributing guidelines
Describe the issue
I'm currently utilizing Next.js version 13.2.3 alongside bootstrap@5.3.0-alpha1. However, I am encountering an issue whereby attempting to close the offcanvas triggers an error message to appear on my development console:
Here is how I setup bootstrap on my .tsx file:
'use client';
import { useEffect } from 'react';
export default function Script() {
useEffect(() => {
typeof document !== 'undefined' && require('bootstrap/dist/js/bootstrap');
}, []);
return null;
}
Please take note that the dropdown is functioning properly, therefore the issue is not related to how I configured bootstrap.
Reduced test cases
What operating system(s) are you seeing the problem on?
macOS
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
bootstrap@5.3.0-alpha1