AngularJS .NET MVC 捆绑缩小错误
AngularJS with .NET MVC Bundling Minification Error
我一直在 .NET MVC 网站中开发大型 AngularJS 应用程序。我已经很长时间没有测试它是否会使用 Bundle Optimiazation Features 成功地缩小?
BundleTable.EnableOptimizations = True
当然,它失败了。我一直在玩 Order I bundle my scripts,并确保我使用 String Literals 作为我的 Controller Names(我没有,这是我必须做的大量重构)。
但如果没有 angular "Unknown Provider" 错误,我无法将我的核心脚本导入 Minifiy。
这是确切的错误:
未捕获的错误:[$injector:modulerr] [http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=ppAccount&p1=Error…redScripts%3Fv%3DknV3wkCOg32ajaw4GwiRSrTXdo8Ue7MRIn65CPYa1b81%3A1%3A379851)]1
这是我失败的捆绑配置:
bundles.Add(new ScriptBundle("~/bundles/PilotPartnerRequiredScripts")
.Include(
"~/UI/js/jquery/jquery-2.1.3.js",
"~/UI/js/plugins/jquery-ui/jquery-ui.js",
"~/UI/js/bootstrap/bootstrap.js",
"~/UI/js/plugins/pace/pace.min.js",
"~/UI/js/plugins/slimscroll/jquery.slimscroll.js",
"~/UI/js/inspinia.js",
"~/UI/js/angular/angular.js",
"~/UI/js/ui-router/angular-ui-router.js",
"~/UI/js/bootstrap/ui-bootstrap-tpls-0.12.1.js",
"~/UI/js/angular/angular-resource.js",
"~/UI/js/angular/angular-sanitize.js",
"~/UI/js/angular/angular-route.js",
"~/UI/js/plugins/switchery/switchery.js",
"~/UI/js/plugins/angular-ui-switch/angular-ui-switch.js",
"~/UI/js/plugins/angularLocalStorage/angular-local-storage.js",
"~/UI/js/plugins/ngDialog/ngDialog.js",
"~/Scripts/ngTags/ng-tags-input.js",
"~/Scripts/uiSortable/sortable.js",
"~/Scripts/kendo/2014.3.1119/kendo.all.min.js",
"~/Scripts/xeditable/xeditable.js"
对于我的一生,我无法弄清楚哪个依赖项没有得到解决。我觉得如果我可以将它缩小到一个特定的依赖项,我知道我可以解决这个问题。
有什么方法可以找到导致问题的特定模块吗?
关于如何使这项工作有任何建议吗?
感谢您的帮助。
注入依赖项(数组表示法)时应始终严格遵循 di
Angualar Doc has mentioned that, Do follow strict DI while doing minification, otherwise it could break you app
例如(代码)
angular.module('myModule', [])
.factory('serviceId', ['depService', function(depService) {
// ...
}])
.directive('directiveName', ['depService', function(depService) {
// ...
}])
.filter('filterName', ['depService', function(depService) {
// ...
}]);
在上面的代码片段中,我遵循了 DI 的内联数组表示法,它已应用于各种 angular 组件只是为了演示它。您应该确保在注入依赖项的任何地方都遵循它。
我一直在 .NET MVC 网站中开发大型 AngularJS 应用程序。我已经很长时间没有测试它是否会使用 Bundle Optimiazation Features 成功地缩小?
BundleTable.EnableOptimizations = True
当然,它失败了。我一直在玩 Order I bundle my scripts,并确保我使用 String Literals 作为我的 Controller Names(我没有,这是我必须做的大量重构)。
但如果没有 angular "Unknown Provider" 错误,我无法将我的核心脚本导入 Minifiy。
这是确切的错误: 未捕获的错误:[$injector:modulerr] [http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=ppAccount&p1=Error…redScripts%3Fv%3DknV3wkCOg32ajaw4GwiRSrTXdo8Ue7MRIn65CPYa1b81%3A1%3A379851)]1
这是我失败的捆绑配置:
bundles.Add(new ScriptBundle("~/bundles/PilotPartnerRequiredScripts")
.Include(
"~/UI/js/jquery/jquery-2.1.3.js",
"~/UI/js/plugins/jquery-ui/jquery-ui.js",
"~/UI/js/bootstrap/bootstrap.js",
"~/UI/js/plugins/pace/pace.min.js",
"~/UI/js/plugins/slimscroll/jquery.slimscroll.js",
"~/UI/js/inspinia.js",
"~/UI/js/angular/angular.js",
"~/UI/js/ui-router/angular-ui-router.js",
"~/UI/js/bootstrap/ui-bootstrap-tpls-0.12.1.js",
"~/UI/js/angular/angular-resource.js",
"~/UI/js/angular/angular-sanitize.js",
"~/UI/js/angular/angular-route.js",
"~/UI/js/plugins/switchery/switchery.js",
"~/UI/js/plugins/angular-ui-switch/angular-ui-switch.js",
"~/UI/js/plugins/angularLocalStorage/angular-local-storage.js",
"~/UI/js/plugins/ngDialog/ngDialog.js",
"~/Scripts/ngTags/ng-tags-input.js",
"~/Scripts/uiSortable/sortable.js",
"~/Scripts/kendo/2014.3.1119/kendo.all.min.js",
"~/Scripts/xeditable/xeditable.js"
对于我的一生,我无法弄清楚哪个依赖项没有得到解决。我觉得如果我可以将它缩小到一个特定的依赖项,我知道我可以解决这个问题。
有什么方法可以找到导致问题的特定模块吗?
关于如何使这项工作有任何建议吗?
感谢您的帮助。
注入依赖项(数组表示法)时应始终严格遵循 di
Angualar Doc has mentioned that, Do follow strict DI while doing minification, otherwise it could break you app
例如(代码)
angular.module('myModule', [])
.factory('serviceId', ['depService', function(depService) {
// ...
}])
.directive('directiveName', ['depService', function(depService) {
// ...
}])
.filter('filterName', ['depService', function(depService) {
// ...
}]);
在上面的代码片段中,我遵循了 DI 的内联数组表示法,它已应用于各种 angular 组件只是为了演示它。您应该确保在注入依赖项的任何地方都遵循它。