Topic: Is mdb.js a module?

ilya premium asked 8 months ago


Hi, while building the theme myself (using Vite) I found that the output javascript file I have to include specifying <script type="module" ... while your CDN version works with <script type="text/javascript" .... I want to know what are the differences between these two files and are there any pitfalls in using the script as a module?


Grzegorz Bujański staff answered 8 months ago


text/javascript these are usually .js files in UMD format. Such a file loaded in your project will increase dependencies by its size. Even if you only use 10% of the code it contains.

modules allow you to use the code you use. This means that your project only uses code that is actually used. Vite relies on ES modules for features such as code splitting and tree shaking. This allows you to limit the size of dependencies.

Unfortunately, our min.js files are currently in UMD format, but soon we will also provide ES modules. Then if you decide to use the ES Modules file and you will use only inputs, select and datatable build of your project will contain the code of only these components.



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: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.0
  • Device: Laptop
  • Browser: Firefox
  • OS: Arch Linux
  • Provided sample code: Yes
  • Provided link: No