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.

tsconfig.json is ignored

See original GitHub issue

Hi everyone, I’ve just realized that tsconfig.json is being ignored. How can I tell to esbuild that we have a tsconfig file?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
privatenumbercommented, Jan 16, 2021

@linonetwo

Assuming you did require('./tsconfig.json'), then your error is because you’re using Node.js’s require to import a JSON with comments. Official JSON spec doesn’t support comments.

Typescript has a custom JSON parser that supports comments. For your use-case, you can use strip-json-comments or json5:

JSON.parse(stripJsonComments(fs.readFileSync('./tsconfig.json')));
JSON5.parse(fs.readFileSync('./tsconfig.json'));
1reaction
nigele-stripecommented, Mar 11, 2021

You can also read the raw tsconfig.json file with the building Typescript config reader API:

function getRawTSConfig(filename: string): any {
  return ts.readConfigFile(filename, fn => fs.readFileSync(fn).toString()).config;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is the TypeScript compiler ignoring tsconfig.json?
json files are ignored. The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript...
Read more >
Allow tsconfig.json when input files are specified · Issue #27379
If no --project or -p option: Ignore tsconfig.json; Otherwise: Use the configuration file specified. All the options used in the command line ...
Read more >
Documentation - What is a tsconfig.json - TypeScript
When input files are specified on the command line, tsconfig.json files are ignored. Examples. Example tsconfig.json files: Using the files property.
Read more >
VS 15.6 ignores tsconfig.json and TypeScriptCompileBlocked
After updating to 15.6 it appears our tsconfig.json seems to be ignored (we are targeting Typescript 2.6). This results in that modules cannot...
Read more >
TypeScript compiler compile all ignores tsconfig.json ...
The TypeScript compiler seems to be ignoring the tsconfig.json typeRoots option. With tsconfig.json in the folder /Volumes/saas-shipping/saas-shipping-ui/ ...
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