How to get real errors using requirejs?

I am new to requireJS and I am trying to understand why I cannot get normal errors.

I use this right after loading the requirejs file, but before loading any modules:

requirejs.onError = function (err) { console.log(err.requireType); if (err.requireType === 'timeout') { console.log('modules: ' + err.requireModules); } throw err; }; 

But I still get a complete undefined error:

 Error: script error http://requirejs.org/docs/errors.html#scripterror @ http://localhost/wampir/lib/require.js:8 "scripterror" 

Is there a way to do this to give me the actual error and line number?

I saw this question , but I tried several answers from there, and they do not change anything ...

+6
source share
1 answer

Delete the timeout check. This prevents you from seeing the modules you are having a problem with if the problem was not a timeout.

 requirejs.onError = function (err) { console.log(err.requireType); console.log('modules: ' + err.requireModules); throw err; }; 
+6
source

Source: https://habr.com/ru/post/955952/


All Articles