awesome-typescript-loader icon indicating copy to clipboard operation
awesome-typescript-loader copied to clipboard

Error : Emit skipped followed by no Typescript error

Open raybooysen opened this issue 9 years ago • 1 comments

In some cases, and I can't figure out why, when we have a syntax error where Typescript cannot compile the code, the loader will output something like the stack trace below but not include the typescript error itself. I then have to run Typescript: tsc and Typescript will show me the actual error.

Any reason why the loader won't show the typescript error?

Typescript output:

src/bootstrapping/shellBootstrapper.ts(58,31): error TS2339: Property 'createChild' does not exist on type 'Logger'.

Typescript Loader output:

Error: Emit skipped Error: Emit skipped
at State.emit (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/host.js:291:23)
at transform (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:203:48)
at _callee3$ (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:258:42)
at tryCatch (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:61:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:329:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:94:21)
at fulfilled (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:31:32)
at run (/home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:89:22)
at /home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:102:28
at flush (/home/ray/source/proj/node_modules/core-js/modules/_microtask.js:18:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
ModuleBuildError: Module build failed: Error: Emit skipped
at State.emit (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/host.js:291:23)
at transform (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:203:48)
at _callee3$ (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:258:42)
at tryCatch (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:61:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:329:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:94:21)
at fulfilled (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:31:32)
at run (/home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:89:22)
at /home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:102:28
at flush (/home/ray/source/proj/node_modules/core-js/modules/_microtask.js:18:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at DependenciesBlock.onModuleBuildFailed (/home/ray/source/proj/node_modules/webpack-core/lib/NormalModuleMixin.js:315:19)
at nextLoader (/home/ray/source/proj/node_modules/webpack-core/lib/NormalModuleMixin.js:270:31)
at /home/ray/source/proj/node_modules/webpack-core/lib/NormalModuleMixin.js:292:15
at context.callback (/home/ray/source/proj/node_modules/webpack-core/lib/NormalModuleMixin.js:148:14)
at _callee3$ (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:285:25)
at tryCatch (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:61:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:329:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/ray/source/proj/node_modules/babel-regenerator-runtime/runtime.js:94:21)
at fulfilled (/home/ray/source/proj/node_modules/awesome-typescript-loader/dist.babel/index.js:31:32)
at run (/home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:89:22)
at /home/ray/source/proj/node_modules/core-js/modules/es6.promise.js:102:28
at flush (/home/ray/source/proj/node_modules/core-js/modules/_microtask.js:18:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
./no
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build-dev"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build-dev: `set NODE_ENV=dev&& webpack --bail --display-reasons --display-error-details`
npm ERR! Exit status 1
npm ERR!
    npm ERR! Failed at the [email protected] build-dev script 'set NODE_ENV=dev&& webpack --bail --display-reasons --display-error-details'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the proj package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     set NODE_ENV=dev&& webpack --bail --display-reasons --display-error-details
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs proj
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls proj
npm ERR! There is likely additional logging output above.

raybooysen avatar Apr 29 '16 13:04 raybooysen

I think instead of simple throw Error("Emit skipped") loader must output diagnostics object in host.ts


let emitResult = this.program.emit(source, writeFile);
//^^^ contains diagnostics property
        let output = {
            outputFiles: outputFiles,
            emitSkipped: emitResult.emitSkipped
        };

        if (!output.emitSkipped) {
            return output;
        } else {
            throw new Error("Emit skipped");
        }

Delagen avatar Sep 21 '16 11:09 Delagen