Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: MDB 5 import modules

riomigal free asked 3 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 3 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';

riomigal free answered 3 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 3 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

  • ForumUser: 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
Tags