coding_idiot
coding_idiot

Reputation: 13734

How to debug requireJS module defined path/file

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

Upvotes: 8

Views: 5109

Answers (1)

coding_idiot
coding_idiot

Reputation: 13734

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.

Upvotes: 13

Related Questions