Topic: MDB Pro jQuery javascript import fails


Topic: Topic: MDB Pro jQuery javascript import fails

rickgoemans asked a year ago

Expected behavior

When you download the jQuery Pro package and add the require('mdbootstrap-pro'); to your own js file, the MDB pro javascript should be correctly imported without any errors.

Actual behavior

If you import import the javascript you get the following error:

 ERROR in ./node_modules/mdbootstrap-pro/js/mdb.min.js
 Module not found: Error: Can't resolve 'chart.js' in '/Users/rickgoemans/Code/hobbybeurs/node_modules/mdbootstrap-pro/js'

Resources (screenshots, code snippets etc.)

I can't even find any chart.js file within my js directory.

Please fix this because at the moment the package is useless and I'm leaning towards a refund!


Mateusz Łubianka staff commented a year ago

Hi @rickgoemans,

Did you see our installation guide? https://mdbootstrap.com/docs/jquery/getting-started/installation-guide/ The code of chart.js is in mdb.js and in the mdb.min.js.

Best,


rickgoemans commented a year ago

Hey Mateusz,

I gave it another go and I got the following error:

This dependency was not found: * chart.js in ./node_modules/mdbootstrap-pro/js/mdb.js To install it, you can run: npm install --save chart.js

ERROR in ./node_modules/mdbootstrap-pro/js/mdb.js Module not found: Error: Can't resolve 'chart.js' in '/Users/rickgoemans/Code/hobbybeurs/node_modules/mdbootstrap-pro/js' @ ./node_modules/mdbootstrap-pro/js/mdb.js 16120:164-187 @ ./resources/js/bootstrap.js @ ./resources/js/app.js @ multi ./resources/js/app.js ./resources/sass/app.scss

So I did "yarn add -D chart.js" and now the JS part works correctly. I guess I read over it yesterday.

But I wonder if this is the standard procedure. Shouldn't your package.json include it in the depencies object? Or shouldn't the code of chart.js be fully included in your source and therefore throw no error?

My problem is solved but I'm just trying to help to prevent other people getting this issue in the future.


Mateusz Łubianka staff answered a year ago

@rickgoemans,

Ok, I will create a task to check this case, and our team will fix it if needed.

Thank you very much :) Best,


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: jQuery
  • MDB Version: 4.12.0
  • Device: Macbook Pro Touchbar 2017
  • Browser: Brave (Chromium based)
  • OS: Mac OS Catalina 10.15.3
  • Provided sample code: No
  • Provided link: No