I have been trying to use gulp-typescript with some degree of success but I have a small issue. All my code is stored under 'src' and I want these to be compiled to '.tmp' but without the 'src' being included.
here is my code, I think the issue is that passing a value (glob) to tsProject.src isn't supported so I get /.tmp/src/aTypescriptFile.js for example
This code I got directly from the github repo, what I really didn't understand is why gulp.src is replaced with tsProject.src
Any ideas ? I do really need to incorporate my tsconfig.json file.
let tsProject = plugins.typescript.createProject('./tsconfig.json');
return tsProject.src('/src/**/*.ts')
.pipe(plugins.typescript(tsProject))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.sourcemaps.write('.'))
.pipe(gulp.dest('.tmp'));
** EDIT **
More info, I have managed to confine it using a glob by replacing the
return tsProject.src('/src/**/*.ts')
with
return gulp.src('/src/**/*.ts')
problem is now that I get an error about missing typings.
src/testme.ts(4,10): error TS2304: Cannot find name 'require'.
my TSCONFIG.JSON file is here, which has the typings in there.
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"files": [
"typings/main.d.ts",
"src/testme.ts"
]
}