MDB 5 import modules


Topic: MDB 5 import modules

savedm asked 4 years ago

Hello,

When import the modules in the app.js file, it imports the whole library.

e.g. using: import { Input } from 'mdb-ui-kit'; // module

import the whole library in the js production file, how can I just import the module?

Thank you


Grzegorz Bujański staff answered 4 years ago

Importing inputs from mdb-ui-kit you import them from the file mdb.min.js - this loads the whole file. Try to import them from the src folder:

import { Input } from 'mdb-ui-kit/src/js/free/input';

You will probably get an error related to 'detect-autofill` you need to install and import it:

npm i detect-autofill

import 'detect-autofill';
import { Input } from 'mdb-ui-kit/src/js/free/input';

savedm answered 4 years ago

Yes, I did it so before and it was working, but I was trying to do it as explained in your installation guide:

Importing JS modules

You can import the entire library or just individual modules: import * as mdb from 'mdb-ui-kit'; // lib import { Input } from 'mdb-ui-kit'; // module

But that did import the whole library...


Grzegorz Bujański staff commented 4 years ago

We are aware of this. We'll fix it


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: 3.2.0
  • Device: Notebook
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No