要求js工作正常,沒有捆綁。但是,無論何時使用捆綁包,我都會嘗試導入模塊超時。RequireJS模塊加載超時使用捆綁
這裏是我如何建立一個與asp.net的MVC捆紮機/束minifier
bundles.Add(new ScriptBundle("~/bundles/test").Include(
"~/scripts/jquery-{version}.js",
"~/scripts/bootstrap.js",
"~/scripts/moment.js"));
bundles.EnableOptimizations = true;
繼承人是需要的js配置在CSHTML文件:
<script>
require.config({
baseUrl: "/scripts",
paths: {
jquery: "jquery-1.11.2"
},
waitSeconds: 20,
shim: {
bootstrap: {
deps: ['jquery']
}
},
bundles: {
'@Scripts.Url("~/bundles/test").ToString()': [
'jquery',
'bootstrap',
'moment'
]
}
});
require(["app/main/test"]);
</script>
而爲的JS page(app/main/test):
require(['jquery', 'moment'], function ($, moment) {
console.log(moment().format());
});
jquery,bootstrap和moment庫在測試包中我有cre ated,但我得到加載超時加載頁面的時刻。
這裏的Chrome檢查錯誤:
任何想法?
在此先感謝。