Import JS Modules


Topic: Import JS Modules

savedm asked 4 years 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 commented 4 years ago

Anyone an idea?


Grzegorz Bujański staff answered 4 years 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.

FREE CONSULTATION

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

Status

Answered

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