Ошибка ключевых слов ecma2015 в Visual Studio 2015 Professional при использовании Task Runner gulp

Вот мой gulpfile.js

import gulp from 'gulp';
import concat from 'gulp-concat';
import wrap from 'gulp-wrap';
import uglify from 'gulp-uglify';
import htmlmin from 'gulp-htmlmin';
import gulpif from 'gulp-if';
import sass from 'gulp-sass';
import yargs from 'yargs';
import ngAnnotate from 'gulp-ng-annotate';
import templateCache from 'gulp-angular-templatecache';
import server from 'browser-sync';
import del from 'del';
import path from 'path';
import child from 'child_process';
import Dgeni from 'dgeni';

const exec = child.exec;
const argv = yargs.argv;
const root = 'src/';
const paths = {
    dist: './dist/',
    distDocs: './docs/build',
    docs: './docs/app/*.js',
    scripts: [`${root}/app/**/*.js`, `!${root}/app/**/*.spec.js`],
    tests: `${root}/app/**/*.spec.js`,
    styles: `${root}/sass/*.scss`,
    templates: `${root}/app/**/*.html`,
    modules: [
      'angular/angular.js',
      'angular-ui-router/release/angular-ui-router.js',
      'firebase/firebase.js',
      'angularfire/dist/angularfire.js',
      'angular-loading-bar/build/loading-bar.min.js'
    ],
    static: [
      `${root}/index.html`,
      `${root}/fonts/**/*`,
      `${root}/img/**/*`
    ]
};

server.create();

gulp.task('clean', cb => del(paths.dist + '**/*', cb));

gulp.task('cleanDocs', cb => del(paths.distDocs + '**/**/*', cb));

gulp.task('templates', () => {
    return gulp.src(paths.templates)
      .pipe(htmlmin({ collapseWhitespace: true }))
      .pipe(templateCache({
          root: 'app',
          standalone: true,
          transformUrl: function (url) {
              return url.replace(path.dirname(url), '.');
          }
      }))
      .pipe(gulp.dest('./'));
});

gulp.task('modules', ['templates'], () => {
    return gulp.src(paths.modules.map(item => 'node_modules/' + item))
      .pipe(concat('vendor.js'))
      .pipe(gulpif(argv.deploy, uglify()))
      .pipe(gulp.dest(paths.dist + 'js/'));
});

gulp.task('styles', () => {
    return gulp.src(paths.styles)
      .pipe(sass({outputStyle: 'compressed'}))
      .pipe(gulp.dest(paths.dist + 'css/'));
});

gulp.task('scripts', ['modules'], () => {
    return gulp.src([
        `!${root}/app/**/*.spec.js`,
        `${root}/app/**/*.module.js`,
        ...paths.scripts,
        './templates.js'
    ])
      .pipe(wrap('(function(angular){\n\'use strict\';\n<%= contents %>})(window.angular);'))
      .pipe(concat('bundle.js'))
      .pipe(ngAnnotate())
      .pipe(gulpif(argv.deploy, uglify()))
      .pipe(gulp.dest(paths.dist + 'js/'));
});

gulp.task('serve', () => {
    return server.init({
        files: [`${paths.dist}/**`],
        port: 4000,
        server: {
            baseDir: paths.dist
        }
    });
});

gulp.task('copy', ['clean'], () => {
    return gulp.src(paths.static, { base: 'src' })
      .pipe(gulp.dest(paths.dist));
});

gulp.task('watch', ['serve', 'scripts'], () => {
    gulp.watch([paths.scripts, paths.templates], ['scripts']);
    gulp.watch(paths.styles, ['styles']);
});

gulp.task('firebase', ['styles', 'scripts'], cb => {
    return exec('firebase deploy', function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
    });
});

gulp.task('default', [
  'copy',
  'styles',
  'serve',
  'watch'
]);

gulp.task('production', [
  'copy',
  'scripts',
  'firebase'
]);

gulp.task('copyDocs', () => {
    return gulp.src(paths.docs)
      .pipe(gulp.dest(paths.distDocs + '/src'));
});

gulp.task('dgeni', ['cleanDocs', 'copyDocs'], () => {
    var dgeni = new Dgeni([require('./docs/config')]);
    return dgeni.generate();
});

Когда я открываю Task Runner, он показывает Не удалось загрузить. Смотрите окно вывода

Вот сообщение об ошибке

Я получаю эту ошибку с некоторыми другими модулями, также как при использовании строковых литералов или функций стрелок.

Нужна помощь.

0 ответов

Другие вопросы по тегам