Topic: Import only needed modules

AnnaK premium asked 4 years ago


Hello!

I noticed in the webpack analyzer, that the ng-uikit-pro-starndard.js is quite big compared to other .js-files. I am only using 5 modules (Accordion, Waves, Carousel, Cards, Collapse), but importing all of them like this:

"ng-uikit-pro-standard": "git+https://oauth2:xxxxxxxxxxxxxxxxxxxx@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git"

Is there any way to import only the needed modules and not the whole thing?

And/or is there another way to import it so that I can specify/know the version I have? Or where can I see which version I have at the moment?


Arkadiusz Idzikowski staff commented 4 years ago

You can find the list of all MDB modules here: https://mdbootstrap.com/docs/angular/getting-started/modules/

If you need to use only the Select and Datepicker components in your app, just import those modules in your main app module and don't include the whole MDBBootstrapModule.

Did you try this approach?


AnnaK premium commented 4 years ago

I do import only the needed modules in the app like this: import { CarouselModule, WavesModule, CardsModule } from 'ng-uikit-pro-standard';

But I was wondering if I could limit the size of the bundle if I didn't have the whole ng-uikit-pro-standard?

And how about the version question? (sorry, I had two questions in one post....)


Arkadiusz Idzikowski staff commented 4 years ago

We will take a closer look at the problem with bundle size.

You should be able to check the current version of the package with this command: npm list ng-uikit-pro-standard.

To install a specific version from our GitLab server, add #version at the end of the installation command line. For example, this command will install v9.4.0.

git+https://oauth2:xxxxxxxxxxxxxxxxxxxx@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git#9.4.0



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: 9.4.0
  • Device: All
  • Browser: All
  • OS: Windows, Android
  • Provided sample code: No
  • Provided link: Yes