Expected behavior: I am running the gulp compile command but i am getting an error saying:
error TS5023: Unknown compiler option 'exclude'.](url)
Also I am getting only the config.json file in DIST folder after compilation.
Actual behavior: The command should run successfully without any error's. Also i should get all the TS files from SRC folder as JS files in DIST folder.
Your gulpfile:
///
var gulp = require('gulp');
var ts = require('gulp-typescript');
var zip = require('gulp-zip');
var del = require('del');
var install = require('gulp-install');
var runSequence = require('run-sequence');
var awsLambda = require("node-aws-lambda");
var sourcemaps = require('gulp-sourcemaps');
var gulpMocha = require('gulp-mocha');
var gutil = require('gulp-util');
gulp.task('compile', function () {
return gulp.src(['src//*.ts' ]) //'typings/*/.d.ts'])
.pipe(sourcemaps.init())
.pipe(ts({
noImplicitAny: false,
removeComments: true,
preserveConstEnums: true,
target: 'es2015',
module: 'commonjs',
noExternalResolve: true,
exclude: ["node_modules", "dist"]
}))
.pipe(babel({
presets: [ 'es2015' ],
plugins: ['transform-runtime']
}))
// sourceRoot must be relative to the running directory
// It appears VSCode does resolve the path relative to the cwd
// so using something like /src doesn't work, it has to be relative
// to the /dist folder where we will run the app from
// Need to test if maps help when errors are thrown in aws and if we should upload them
.pipe(sourcemaps.write('.', { sourceRoot: '../src' }))
.pipe(gulp.dest('./dist'))
,
gulp.src(['src//*.json'])
.pipe(gulp.dest('./dist'));
});
/// ***** UNIT TEST TASKS **
gulp.task('compiletest', function () {
return gulp.src(['test/*/.ts' ]) //'typings//*.d.ts'])
.pipe(sourcemaps.init())
.pipe(ts({
noImplicitAny: true,
removeComments: true,
preserveConstEnums: true,
target: 'es2015',
module: 'commonjs',
noExternalResolve: true,
exclude: ["node_modules", "testJs"]
}))
.pipe(babel({
presets: [ 'es2015' ],
plugins: ['transform-runtime']
}))
// sourceRoot must be relative to the running directory
// It appears VSCode does resolve the path relative to the cwd
// so using something like /src doesn't work, it has to be relative
// to the /dist folder where we will run the app from
// Need to test if maps help when errors are thrown in aws and if we should upload them
.pipe(sourcemaps.write('.', { sourceRoot: '../test' }))
.pipe(gulp.dest('./testJs'));
});
-->
Expected behavior: I am running the gulp compile command but i am getting an error saying: error TS5023: Unknown compiler option 'exclude'.](url) Also I am getting only the config.json file in DIST folder after compilation.
Actual behavior: The command should run successfully without any error's. Also i should get all the TS files from SRC folder as JS files in DIST folder.
Your gulpfile: ///
var gulp = require('gulp');
var ts = require('gulp-typescript');
var zip = require('gulp-zip');
var del = require('del');
var install = require('gulp-install');
var runSequence = require('run-sequence');
var awsLambda = require("node-aws-lambda");
var sourcemaps = require('gulp-sourcemaps');
var gulpMocha = require('gulp-mocha');
var gutil = require('gulp-util');
const babel = require('gulp-babel'); gulp.task('clean', function () { return del(['./dist','./testJs', './dist.zip']); });
gulp.task('compile', function () { return gulp.src(['src//*.ts' ]) //'typings/*/.d.ts']) .pipe(sourcemaps.init()) .pipe(ts({ noImplicitAny: false, removeComments: true, preserveConstEnums: true, target: 'es2015', module: 'commonjs', noExternalResolve: true, exclude: ["node_modules", "dist"] })) .pipe(babel({ presets: [ 'es2015' ], plugins: ['transform-runtime']
})) // sourceRoot must be relative to the running directory // It appears VSCode does resolve the path relative to the cwd // so using something like /src doesn't work, it has to be relative // to the /dist folder where we will run the app from // Need to test if maps help when errors are thrown in aws and if we should upload them .pipe(sourcemaps.write('.', { sourceRoot: '../src' })) .pipe(gulp.dest('./dist')) , gulp.src(['src//*.json']) .pipe(gulp.dest('./dist')); });
gulp.task('node-mods', function () { return gulp.src('./package.json') .pipe(gulp.dest('dist/')) .pipe(install({ production: true })); });
gulp.task('zip', function () { return gulp.src(['dist/*/', '!dist/package.json', '!dist/*.map']) .pipe(zip('1033_RMSG_MRDR.zip')) .pipe(gulp.dest('./dist/zip/')); });
/ gulp.task('upload', ['zip'], function (callback) { awsLambda.deploy('./MME_TO_SAP EAC_VS_CODE PROJECT.zip', require("./lambda-config.js"), callback); }); /
gulp.task('deploy', function (callback) { return runSequence( 'clean', 'compile', 'compiletest', 'test', 'node-mods', callback ); });
/// ***** UNIT TEST TASKS ** gulp.task('compiletest', function () { return gulp.src(['test/*/.ts' ]) //'typings//*.d.ts']) .pipe(sourcemaps.init()) .pipe(ts({ noImplicitAny: true, removeComments: true, preserveConstEnums: true, target: 'es2015', module: 'commonjs', noExternalResolve: true, exclude: ["node_modules", "testJs"] })) .pipe(babel({ presets: [ 'es2015' ], plugins: ['transform-runtime']
})) // sourceRoot must be relative to the running directory // It appears VSCode does resolve the path relative to the cwd // so using something like /src doesn't work, it has to be relative // to the /dist folder where we will run the app from // Need to test if maps help when errors are thrown in aws and if we should upload them .pipe(sourcemaps.write('.', { sourceRoot: '../test' })) .pipe(gulp.dest('./testJs')); });
gulp.task('test', function(){ return gulp.src(['testJS/*/.js'],{read:false}) .pipe(gulpMocha({reporter:'list'})) .on('error', gutil.log); })
tsconfig.json { "compilerOptions": { "module": "commonjs", "removeComments": true, "preserveConstEnums": true, "target": "es2015" }, "exclude": ["node_modules", "dist"] }
Screenshots![image](https://user-images.githubusercontent.com/27077036/78327135-c859dd00-7599-11ea-95e5-24649154c916.png)
If you see in the above screenshot after compilation only config.json is available where i am expecting all the file in JS format from SRC.
And this is the error i get while running the command gulp compile.