摘要
我正在尝试使用require.js加载敲除组件。我不断收到错误Uncaught Error: Load timeout for modules: /components/myComponent.js
。
文件结构
对于每个“ .ts”文件,都有一个生成的“ .js”文件。
组件
window.ts
window.html
components.ts(GitHub要点)
config.ts(GitHub要点)
index.ts(GitHub要点)
出问题的地方
viewModelPath = '/components/window.'
在components.ts中的函数components.register()
中(GitHub内容):
58 | viewModel = new Promise(resolve => requirejs([viewModelPath], resolve));
^^^^^^^^^
我用chrome调试器调试了Require.JS,最后,moduleName
是'_@e7'
,URL是'/_@e7.js'
。 Bu从未提出URL请求...
我尝试过的事情
我尝试加载模块而不是路径,但没有结果。
index.ts
内部进行请求时, Require.JS可以正常工作,而无需在其他任何地方使用requirejs()
。如果components.register(...)
,将永远不会发出请求。