简体   繁体   中英

Getting error using gulp and grunt concat in Angular project

I am getting an issue when I concatenate files. The same issue occurs using Grunt, Gulp and the "Bundler and Minifier Extension" for Visual Studio. I have no idea what the problem is.

It concatenates without error when I include modules, services and model files. The issue arises when I include a controller file. An example of one of my controller files is given below:

/// <reference path="../../typings/angularjs/angular.d.ts" />
/// <reference path="../../typings/angularjs/angular-ui-router.d.ts" />
var MyApp;
(function (MyApp) {
var MainController = (function () {
function MainController() {
        this.message = "...message";
    }
    return MainController;
}());
angular
    .module("MyApp")
    .controller("MainController", MainController);
})(MyApp || (MyApp = {}));
//# sourceMappingURL=home-ctlr.js.map

This was just to do with the order in which the files were being concatenated. Up until I included controllers, by accident I hadn't loaded anything that depended on something that hadn't already been loaded. When I included the controllers they were in a directory that was one of the first to be loaded and since they depended on services which were loaded later the whole thing failed. Answer - check the order of your files or the order of your directories if you are using wildcards on parent directories and then amend the "src" line .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM