'Can't access property "display", DataTable.Responsive is undefined $.fn.dataTable.Response

I tried to use jquery datatables in my laravel project and work perfectly. But wen i tried to add plugins with boostrap-5 compatibility a had this error.

try {
    window.$ = window.jQuery = require('jquery');
    window.Popper = require('@popperjs/core');
    window.bootstrap = require('bootstrap');
    Window.dataTable = require( 'datatables.net' )( window, $ );

} catch (e) {}
import( 'datatables.net-responsive-bs5' );  
var DataTable = $.fn.dataTable;
var _display = DataTable.Responsive.display;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source