我遇到了一个问题,当我为我的墨西哥湾运行任务跑步者时,它将我所有的.ts file定位于Resource.service.ts,似乎错过了。p>下面显示了Gulp脚本接受和针对的文件:
- main.ts
- resource.ts
- Resource-list.component.ts
- test.component.ts
- test.module.ts
引用的特定任务TARGIT THIN.SERVICE.TS文件是应用程序任务。
以下是我的Gulp脚本:
//References to required plugins
var gulp = require("gulp"),
gp_clean = require('gulp-clean'),
gp_concat = require('gulp-concat'),
gp_sourcemaps = require('gulp-sourcemaps'),
gp_typescript = require('gulp-typescript'),
gp_uglify = require('gulp-uglify'),
gp_typescript_config = require('gulp-ts-config');
//Define source paths
var srcPaths = {
app: ['app/main.ts', 'app/**/*.ts'],
js: ['js/**/*.js',
'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',
'node_modules/typescript/lib/typescript.js']
, js_angular: ['node_modules/@angular/**']
, js_rxjs: ['node_modules/rxjs/**']
};
//Define destination paths
var destPaths = {
app: 'wwwroot/app/',
app_local: 'app/',
js: 'wwwroot/js/',
js_angular: 'wwwroot/js/@angular/',
js_rxjs: 'wwwroot/js/rxjs/'
};
//Compile, minifiy, and create sourcemaps for typescipt files and place them in wwwroot/app, together with the js.map files
gulp.task('app', function() {
return gulp.src(srcPaths.app)
.pipe(gp_sourcemaps.init())
.pipe(gp_typescript(require('./tsconfig.json').compilerOptions))
.pipe(gp_uglify({ mangle: false }))
.pipe(gp_sourcemaps.write('/'))
.pipe(gulp.dest(destPaths.app));
});
//Delete contents of wwwroot/app
gulp.task('app-clean', function () {
return gulp.src(destPaths.app + "*", { read: false })
.pipe(gp_clean({ force: true }));
});
//Copy js files from external libs to wwwroot/js
gulp.task('js', function () {
gulp.src(srcPaths.js_angular)
.pipe(gulp.dest(destPaths.js_angular));
gulp.src(srcPaths.js_rxjs)
.pipe(gulp.dest(destPaths.js_rxjs));
return gulp.src(srcPaths.js)
.pipe(gulp.dest(destPaths.js));
});
//Delete contents of wwwroot/js
gulp.task('js-clean', function () {
return gulp.src(destPaths.js + "*", { read: false })
.pipe(gp_clean({force: true }));
});
//Watch files and act on change
gulp.task('watch', function () {
gulp.watch([srcPaths.app, srcPaths.js], ['app', 'js']);
});
//Global clean
gulp.task('cleanup', ['app-clean', 'js-clean']);
//Default task
gulp.task('default', ['app', 'js', 'watch']);
用于参考,这是在Visual Studio 2017
我发现了我的自我。似乎Gulp对我有两个.TS文件称为资源(resource.ts and resource.service.ts(的事实并不满意。通过将Resource.Service.ts更改为Resourceservice.service.ts,我能够像项目中的其他文件一样正确地定位了gulp中的文件。