Crossroads.js and require.js

梦想与她 提交于 2019-12-13 07:09:55

问题


I want to use crossroads.js with require.js to determine what file to require based on the URL.

I have crossroads set as a dependancy in a Router.js file and if I console.log(crossroads) straight out from the crossroads.js file I get the crossroads object. However it isnt getting passed to the Router.js file, its null or undefined... Wonder if anyone has had this issue before?

Cheers in advance.


回答1:


Crossroads.js works with RequireJS since the beginning (I use RequireJS on all my projects) you probably had some misconfiguration on your paths or expected the global crossroads var to be exposed (which doesn't happen on an AMD environment) or maybe crossroads was being loaded before RequireJS (which would skip the AMD define process).



来源:https://stackoverflow.com/questions/8618444/crossroads-js-and-require-js

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