我試圖部署基於Durandal的解決方案。但是,我在部署後出現以下錯誤。未捕獲的ReferenceError:requirejs未定義main.js
Uncaught ReferenceError: requirejs is not defined main.js:1
(anonymous function)
我探索了與項目一起部署的文件,並要求包含在解決方案/路徑中。這些文件已經與他們一起部署。開發和生產副本之間的所有不同之處在於我的java腳本文件被壓縮。我的下一步是以任何方式查看這是否與此問題有關?
更新: 我找到了問題的根源是以下幾點:
<body>
<div id="applicationHost">
@Html.Partial("_splash")
</div>
@Scripts.Render("~/scripts/vendor")
@if (HttpContext.Current.IsDebuggingEnabled)
{
<script type="text/javascript" src="~/App/durandal/amd/require.js" data-main="@Url.Content("~/App/main")"></script>
}
else
{
<script type="text/javascript" src="~/App/main.js"></script>
}
</body>
如果我刪除IsDebuggingEnabled檢查,只留下下面所有的工作(顯然)
<script type="text/javascript" src="~/App/durandal/amd/require.js" data-main="@Url.Content("~/App/main")"></script>
據我記得,我沒有觸及這個代碼(在模板的初始項目設置上創建)。所有應該都是來自Durandal VSX模板。
任何想法爲什麼需要在非調試部署期間被刪除? :/
...作爲旁註。投票的評論比隨機引發的投票更有用。如果沒有建設性的反饋,任何人都會學習嗎? –
我同意。 upvoted補償。 – RainerAtSpirit