question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to debug "TypeScript emitted no output for..." properly?

See original GitHub issue

Sorry, but I don’t know were to ask, so I hope I get some help here as I don’t find any other helpful resources.

We currently try to switch from “awesome-typescript-loader” to “ts-loader”. Simply switching the webpack config leads to errors like the following:

[...]
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for [...]

without any more helpful information.

tsc for example run without a problem.

So my question is: How can I find out / debug deeper, what in detail is happening and maybe to get some more helpful error messages?

I expect that the error originates from typescript not being able to do some import statements properly but I did not find a way to debug, what is going wrong and why.

if it helps tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "jsx": "react",
    "lib": ["es6", "dom", "esnext"],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmit": true,
    "noImplicitAny": false,
    "sourceMap": true,
    "strict": true,
    "target": "es5"
  },
  "include": ["./frontend/**/*"]
}

thanks in advance!

EDIT: So I tried to track it down and now I have the following file, that does not compile with ts-loader with the above error message and i am really lost^^

import React from 'react';

type InventoryStatsProps = {
  t: any;
  i18n: any;
  tReady: boolean;
};

export const InventoryStatsTile: React.FC<InventoryStatsProps> = () => {
  return <div>lkajskdjaksd</div>;
};

export default InventoryStatsTile;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andrewbranchcommented, Feb 16, 2021

@berickson1’s excellent debugging guide* 😉

0reactions
reorxcommented, May 13, 2022

Hi @andrewbranch and @johnnyreilly , just read the excellent guide, but I didn’t get to know how to expose the detailed error of TypeScript under the hood, can you please give some advice? The requirement is simple, just want to see the exact error of tsc compiling process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack with typescript getting TypeScript emitted no output ...
Check that you don't have noEmit set to true In your tsconfig.json file.
Read more >
Typescript emitted no output · Issue #767 · TypeStrong/ts-loader
Getting the following error: Module build failed: Error: Typescript emitted no output for C:\xampp\htdocs\node-api\src\js\server.ts ...
Read more >
typescript emitted no output for - You.com | The search engine you ...
I expect that the error originates from typescript not being able to do some import statements properly but I did not find a...
Read more >
webpack/webpack - Gitter
I'm using module federation and promised based dynamic remotes (https://webpack.js.org/concepts/module-federation/#promise-based-dynamic-remotes). Everything is ...
Read more >
TSConfig Reference - Docs on every TSConfig option
Controls whether TypeScript will emit a byte order mark (BOM) when writing output files. Some runtime environments require a BOM to correctly interpret...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found