使用browserify和angular throws的Gulp任务SyntaxError:意外的令牌

时间:2016-08-11 02:23:11

标签: gulp browserify gulp-watch

我的gulp任务是给出以下错误:

events.js:160
      throw er; // Unhandled 'error' event
      ^
 SyntaxError: Unexpected token

我的吞咽任务就像休耕一样:

var gulp = require('gulp-param')(require('gulp'), process.argv);
var browserify = require('browserify');
var source = require('vinyl-source-stream');


gulp.task('browserify', function(app) {
    var app = app || 'main';
    var mainConfig = {
        input: './js/app.js',
        output: 'main.js'
    };
    var signinConfig = {
        input: './js/signin-app.js',
        output: 'signin.js'
    };
    var config = (app == 'main')?mainConfig:signinConfig; 
    return browserify(config.input)
        .bundle()
        .pipe(source(config.output))
        .pipe(gulp.dest('./dist/'));
});

gulp.task('watch', function(){
    gulp.watch('./js/**/*.js', ['browserify']);
}) 

我的app.js文件如下:

'use strict'

require('./deps.js');

var hireAlchamyApp = angular.module('hireAlchamyApp',
    ['ngSanitize',
        'ngRoute',
        'ngMessages',
        'ui.bootstrap',
        'blockUI',
        'angularSpinner',
        'ui.select']);

require('./services')(hireAlchamyApp);

hireAlchamyApp.filter('propsFilter', require('./filters/props.js'));

hireAlchamyApp.controller('header_controller', require('./controllers/header-options.js'));
hireAlchamyApp.controller('CreatePositionCtrl', require('./controllers/create-position.js'));
hireAlchamyApp.controller('CreateProjectCtrl', require('./controllers/create-project.js'));
hireAlchamyApp.controller('positionSettingsCtrl', require('./controllers/position-settings.js'));
hireAlchamyApp.controller('CollapseDemoCtrl', require('./controllers/header.js'));
hireAlchamyApp.controller('dashboardCtrl', require('./controllers/dashboard.js'));
hireAlchamyApp.controller('projectCtrl', require('./controllers/projects.js'));
hireAlchamyApp.controller('projectPositionsCtrl', require('./controllers/projects-positions.js'));
hireAlchamyApp.controller('CandidateCtrl', require('./controllers/candidate.js'));
hireAlchamyApp.controller('shortlistControl', require('./controllers/position.js'));
hireAlchamyApp.controller('accountSettingController', require('./controllers/user-profile.js'));
hireAlchamyApp.controller('sourceController', require('./controllers/sources.js'));
hireAlchamyApp.controller('candidateInfoController', require('./controllers/candidate-basic.js'));
hireAlchamyApp.controller('internalPoolCtrl', require('./controllers/internalpool.js'));
hireAlchamyApp.config(['$routeProvider', function($routeProvider) {....}]);

0 个答案:

没有答案