Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS5023: Unknown compiler option 'exclude'. in gulpfile,js #647

Open
Manoj-Chakladar opened this issue Apr 3, 2020 · 0 comments
Open

Comments

@Manoj-Chakladar
Copy link

-->

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

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.

image

And this is the error i get while running the command gulp compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant