ivogabe / gulp-typescript

A TypeScript compiler for gulp with incremental compilation support.
MIT License
831 stars 129 forks source link

TypeError: Cannot read property 'file' of undefined #623

Closed viT-1 closed 4 years ago

viT-1 commented 4 years ago

Expected behavior: Gulp task is completed

Actual behavior: Gulp task throws error TypeError: Cannot read property 'file' of undefined at Output.getError (C:\Projects\systemjs-ts-es6\node_modules\gulp-typescript\release\output.js:138:29) at Output.diagnostic (C:\Projects\systemjs-ts-es6\node_modules\gulp-typescript\release\output.js:143:25) at ProjectCompiler.emit (C:\Projects\systemjs-ts-es6\node_modules\gulp-typescript\release\compiler.js:129:33) at ProjectCompiler.inputDone (C:\Projects\systemjs-ts-es6\node_modules\gulp-typescript\release\compiler.js:80:18) at CompileStream.end (C:\Projects\systemjs-ts-es6\node_modules\gulp-typescript\release\project.js:122:31) at DestroyableTransform.onend (C:\Projects\systemjs-ts-es6\node_modules\readable-stream\lib_stream_readable.js:577:10) at Object.onceWrapper (events.js:286:20) at DestroyableTransform.emit (events.js:203:15) at DestroyableTransform.EventEmitter.emit (domain.js:466:23) at endReadableNT (C:\Projects\systemjs-ts-es6\node_modules\readable-stream\lib_stream_readable.js:1010:12)

Your gulpfile.esm.js:

import tts from 'ttypescript';
import typescript from 'gulp-typescript';
import {
    src,
    dest,
    task,
    parallel,
} from 'gulp';

task('deploy.dev',
    () => {
        // Transpiling for browser tsconfig
        const tsApp = typescript.createProject(
            './src/tsconfig.dev.json',
            { typescript: tts },
        );

        const tsResult = tsApp.src()
            .pipe(tsApp()).js;

        return tsResult
            .pipe(uglifyES())
            .pipe(dest(
                // deploy dev files
                tsApp.config.compilerOptions.outDir,
            ));
    });
viT-1 commented 4 years ago

Tested same tsconfig with npm script ttsc --project ./tsconfig.json it's ok, but gulp-typescript configuration is not.

ivogabe commented 4 years ago

Fixed in #627

viT-1 commented 4 years ago

@ivogabe Last released version in npmjs is 5.0.1 When this fix will be released?

ivogabe commented 4 years ago

I plan to fix some other problems as well. I hope to release it this week

ivogabe commented 4 years ago

Published as 6.0.0-alpha.1.

viT-1 commented 4 years ago

No, 6.0 is not fixed for me =(

TypeError: Cannot read property 'file' of undefined
    at Output.getError (xxx\node_modules\gulp-typescript\release\output.js:139:29)
    at Output.diagnostic (xxx\node_modules\gulp-typescript\release\output.js:144:25)
    at ProjectCompiler.emit (xxx\node_modules\gulp-typescript\release\compiler.js:131:33)
    at ProjectCompiler.inputDone (xxx\node_modules\gulp-typescript\release\compiler.js:80:18)
    at CompileStream.end (xxx\node_modules\gulp-typescript\release\project.js:125:31)
    at DestroyableTransform.onend (xxx\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:286:20)
    at DestroyableTransform.emit (events.js:203:15)
    at DestroyableTransform.EventEmitter.emit (domain.js:466:23)
    at endReadableNT (xxx\node_modules\readable-stream\lib\_stream_readable.js:1010:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
ivogabe commented 4 years ago

Sorry, you were having a different issue as what I thought. Can you share a TypeScript file on which you see this error? That would make it easier for me to debug this.

viT-1 commented 4 years ago

@ivogabe : Sorry, i'm checking your library on small project & everything is working, thanks!

ivogabe commented 4 years ago

Great, that's good news :)