Import JS Modules


Topic: Import JS Modules

savedm pro priority asked 3 months ago

Hello,

I am using module imports, but it imports the whole library.

E.g. if I want to import

import { Modal } from 'mdb-ui-kit';

Webpack compiles the whole library in prod mode: (Laravel 8 Project)

      /css/app.css    124 KiB       0  [emitted]         /js/app    
        /js/app.js   1.08 MiB       0  [emitted]  [big]  /js/app   

Could you please help?

Thank you


savedm pro priority commented 3 months ago

Anyone an idea?


Grzegorz Bujański staff answered 3 months ago

Hi. If you only need a few of our components, you should import them from the src folder. For a modal it will be:

import { Modal } from 'mdb-ui-kit/src/js/free/modal';


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB 5
  • MDB Version: 2.0.0
  • Device: Notebook
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No
Tags