Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为angular2创建生产构建,并进行吞咽_Angular_Typescript_Build_Gulp - Fatal编程技术网

为angular2创建生产构建,并进行吞咽

为angular2创建生产构建,并进行吞咽,angular,typescript,build,gulp,Angular,Typescript,Build,Gulp,我正试图创建生产建设的角度2与吞咽 下面是我的吞咽文件 const gulp = require('gulp'); const browserSync = require('browser-sync').create(); const del = require('del'); const typescript = require('gulp-typescript'); const tscConfig = require('./tsconfig.json'

我正试图创建生产建设的角度2与吞咽

下面是我的吞咽文件

    const gulp = require('gulp');
    const browserSync = require('browser-sync').create();
    const del = require('del');
    const typescript = require('gulp-typescript');
    const tscConfig = require('./tsconfig.json');
    const tslint = require('gulp-tslint');

   // clean the contents of the distribution directory
   gulp.task('clean', function () {
     return del('dist/**/*');
   });

   // TypeScript compile
   gulp.task('compile', ['clean'], function () {
     return gulp
      .src('app/**/*.ts')
      .pipe(typescript(tscConfig.compilerOptions))
      .pipe(gulp.dest('dist/app'));
   });

  gulp.task('copy:libs', ['clean'], function() {
   return gulp.src([
    'node_modules/core-js/client/shim.min.js',
    'node_modules/zone.js/dist/zone.js',
    'node_modules/reflect-metadata/Reflect.js',
    'node_modules/systemjs/dist/system.src.js',
   ])
   .pipe(gulp.dest('dist/lib'))
 });

 // copy static assets - i.e. non TypeScript compiled source
 gulp.task('copy:assets', ['clean'], function() {
   return gulp.src(['app/**/*', 'index.html', 'styles.css', '!app/**/*.ts'], { base : './' })
     .pipe(gulp.dest('dist'))
 });

 gulp.task('tslint', function() {
   return gulp.src('app/**/*.ts')
    .pipe(tslint())
    .pipe(tslint.report('verbose'));
 });

  gulp.task('build', ['tslint', 'compile', 'copy:libs', 'copy:assets']);
  gulp.task('default', ['build']);

  gulp.task('watch', ['build']);gulp.task('watch', function() {
     gulp.watch('app/**/*.ts', ['compile']).on('change', browserSync.reload);
     gulp.watch('app/**/*.html', ['compile']).on('change', browserSync.reload);
  });

  // create a task that ensures the `js` task is complete before
  // reloading browsers
  gulp.task('js-watch', ['watch'], function (done) {

  });

  gulp.task('browser-sync', function() {
    browserSync.init({
      server: {
          baseDir: "./"
      }
  });
 });

// Static Server + watching scss/html files
 gulp.task('serve', ['js-watch', 'browser-sync'], function() {

     browserSync.init({
       server: "./"
     });
 });
当我运行gulp时,它会创建dist文件夹,如果我将dist文件夹复制到apache,应用程序就会正常运行。 问题是页面加载上的依赖项太多,
我正在尝试创建一个可以加快页面加载速度的构建。

您应该尝试绑定..检查了吗?您应该尝试绑定..检查了吗?