Topic: Importing MDB on the app.js not working

Salekur Rahaman free asked 1 year ago

I'm using MDB free version.But import * as mdb from 'mdb-ui-kit'; not properly working.

After importing the MDB js library or module, my entire js code not working. Also, it gives me the error given below:

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at v._getHeight (mdb-ui-kit.js?v=919936fe:1879:31)
    at v._saveInitialHeights (mdb-ui-kit.js?v=919936fe:1883:107)
    at v._init (mdb-ui-kit.js?v=919936fe:1846:52)
    at new v (mdb-ui-kit.js?v=919936fe:1808:98)
    at mdb-ui-kit.js?v=919936fe:1894:29
    at Array.forEach (<anonymous>)
    at Module.n (mdb-ui-kit.js?v=919936fe:1892:37)
    at o (mdb-ui-kit.js?v=919936fe:4427:75)
    at mdb-ui-kit.js?v=919936fe:4424:20
    at mdb-ui-kit.js?v=919936fe:9:82

Note that, I'm using the MDB node package on Laravel (v9.26.1)

Grzegorz Bujański staff answered 1 year ago

How do you import MDB? I created a project from scratch and I don't see this error. My configuration looks like this:


import './bootstrap';
import * as mdb from 'mdb-ui-kit'; // lib
import 'mdb-ui-kit/css/mdb.min.css';


<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <body class="antialiased">

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: Windows 11
  • Browser: Google Chrome (v104.0.5112.102)
  • OS: Windows 11 (64)
  • Provided sample code: No
  • Provided link: No