How to debug requireJS module defined path/file

China☆狼群 提交于 2020-02-26 06:40:26

问题


I'm new to RequireJS world. I'm getting Load Timeout error for one of the modules, which I've already defined in the main file. I don't see any request in Network tab of Chrome, probably because require has already loaded that file earlier.

I've hooked to onError event of require & I see the error. But the stack doesn't give the exact location/name of the file which tried to load this module. Is there any way to figure out the exact file/linesOfCode ?

Also, is there any way to figure out at runtime all paths that are defined in requireJS, some API like require.getPaths()


回答1:


requirejs.s.contexts._.config.paths

This will return all paths defined in requirejs. If there are multiple .config calls, it seems to contain all with no duplicates.



来源:https://stackoverflow.com/questions/24462403/how-to-debug-requirejs-module-defined-path-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!