最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to debug requireJS module defined pathfile - Stack Overflow

programmeradmin1浏览0评论

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()

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()

Share Improve this question asked Jun 28, 2014 at 0:20 coding_idiotcoding_idiot 13.7k10 gold badges71 silver badges119 bronze badges 1
  • 1 It is absolutely infuriating that a typo in a path name is so impossible to track down. Thanks, require – Kabir Sarin Commented Jun 30, 2015 at 19:25
Add a ment  | 

1 Answer 1

Reset to default 13
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.

发布评论

评论列表(0)

  1. 暂无评论