Topic: MDB 5 import modules
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...
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- 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