I can not understand how to properly import the module?

Now like this:

import noty from 'noty' window.mindy = { notify: (text, type = 'success') => { noty({ text: text, type: type, theme: 'metroui', layout: 'topRight', timeout: false, progressBar: false, closeWith: ['click'], animation: { open: { height: 'toggle' }, close: { height: 'toggle' }, easing: 'swing', speed: 300, }, }) }, } 

But it gives an error

enter image description here

noty.js: 2349

 function _classCallCheck(instance, Constructor) { if (! (instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 

noty.js: 2359

 _classCallCheck(this, Noty) 
  • And what is in the lines noty.js: 2359 and noty.js: 2349? - Pavel Mayorov
  • @PavelMayorov now I will add the question itself with screenshots - msupreme
  • No screenshots! Only text. - Pavel Mayorov
  • @PavelMayorov 2359 _classCallCheck (this, Noty); - msupreme
  • @PavelMayorov 2349 function _classCallCheck (instance, Constructor) {if (! (Instance instanceof Constructor)) {throw new TypeError ("Cannot call a class as a function"); }} - msupreme

1 answer 1

The noty.js file shows that you are using the third version of noty, and not the second version (the second version is in the jquery.noty.js or jquery.noty.packaged.js )

In the third version, Noty is a class, not a function, and should be called as new Noty(...) .

  • Thank you very much. Just also wondered if I read the correct version of the documentation - msupreme