Skip to content

Sometimes gulp-typescript doesn't generate any files when using typescript@next #223

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

Closed
kenotron opened this issue Oct 29, 2015 · 10 comments

Comments

@kenotron
Copy link

Now Typescript at 1.8.0-dev.20151028, with gulp-typescript, I've been able to repro a bug where gulp-typescript just doesn't output anything.

@kenotron
Copy link
Author

With the included TS 1.6.2, works fine. I would see the "dist" directory being generated. But with the typescript@next, it wouldn't generate anything. Strange thing is: if I renamed my importanceType.ts to bar.ts, it would generate it fine. I am very confused as to why the name of the file / module would make gulp-typescript work / not work.

Just to give more details, I have my directory structure as such:

foo/
  node_modules/
  src/
    foo.ts
    importanceType.ts
  package.json
  gulpfile.js

my gulpfile.js is

var gulp = require('gulp');
var ts = require('gulp-typescript');

gulp.task('default', function () {
    return gulp.src('src/**/*.ts')
        .pipe(ts({
            typescript: require('typescript'),
            "target": "ES5",
            "module": "commonjs",
            "jsx": "react",
            "sourceMap": true,
            "experimentalDecorators": true,
            "declaration": true,
            "removeComments": true
        }))
        .pipe(gulp.dest('dist'));
});

my importanceType.ts

enum importanceType {
    Low = 0,
    Normal = 1,
    High = 2
};

export default importanceType;

@ivogabe
Copy link
Owner

ivogabe commented Oct 29, 2015

Thanks for reporting, I'll take a look at this. Can you also run the tsc command on your project, to see whether this is a bug of gulp-typescript or TypeScript?

@kenotron
Copy link
Author

tsc works fine in the command line. My tsc is pegged at @1.8.0-dev.20151028

@kenotron
Copy link
Author

Forgot to type in foo.ts contents:

import importanceType from './importanceType'

@kenotron
Copy link
Author

Doing some sleuthing and debugging. Seems like the input.ts's commonSourceDirectory is getting this for fileNames:

Array[4]
0:"E:\workspace\testmodules-backup\packages\foo\src\foo.ts"
1:"E:\workspace\testmodules-backup\packages\foo\src\importanceType.ts"
2:"E:\workspace\testmodules-backup\packages\foo\src________________empty.ts"
3:"src/importanceType.ts"

where as [email protected] gives this:

0:"E:\workspace\testmodules-backup\packages\foo\src\foo.ts"
1:"E:\workspace\testmodules-backup\packages\foo\src\importanceType.ts"
2:"E:\workspace\testmodules-backup\packages\foo\src________________empty.ts"

Something went wonky with the input.ts

@kenotron
Copy link
Author

I think I might have a fix: the problem is that ts@next started passing in relative paths to the getSourceFile in the compiler host. You need to simulate the behavior for [email protected]+... I'll work up a PR for you I think to fix this.

@ghost
Copy link

ghost commented Oct 29, 2015

This seems related to microsoft/TypeScript#5455

@ghost
Copy link

ghost commented Oct 29, 2015

@kenotron seems right, tsc runs fine for me, 1028 and 1029 have the same issue.

@ivogabe
Copy link
Owner

ivogabe commented Nov 3, 2015

Looks like the old behavior has been reverted in microsoft/TypeScript#5462. @kenotron does using the latest TypeScript build solve this issue?

@kenotron
Copy link
Author

kenotron commented Nov 4, 2015

So, by not doing anything, you have dodged a bullet there :) Yes I think this is fixed with typescript@next.

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

Successfully merging a pull request may close this issue.

2 participants