Loading external tsconfig files not working properly

The problem

We have the following tsconfig.json for some of our packages

  "extends": "@tsconfig/ember/tsconfig.json",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "dummy/tests/*": ["tests/*"],
      "dummy/*": ["tests/dummy/app/*", "app/*"],
      foo": ["addon"],
      "foo/*": ["addon/*"],
      "foo/test-support": ["addon-test-support"],
      "foo/test-support/*": ["addon-test-support/*"],
      "*": ["types/*"]
  "include": [

But when sonar scan is running we recieve the following error

27-Feb-2024 09:25:19	INFO: Creating TypeScript program
27-Feb-2024 09:25:19	INFO: TypeScript configuration file /usr/src/packages/foo/tsconfig.json
27-Feb-2024 09:25:19	WARN: Could not find tsconfig.json: /node_modules/@tsconfig/ember/tsconfig.json; falling back to an empty configuration.
27-Feb-2024 09:25:20	WARN: At least one tsconfig.json was not found in the project. Please run 'npm install' for a more complete analysis. Check analysis logs for more details.
27-Feb-2024 09:25:20	INFO: Creating TypeScript program (done) | time=224ms
27-Feb-2024 09:25:20	INFO: Starting analysis with current program
27-Feb-2024 09:25:20	INFO: Analyzed 0 file(s) with current program 


As far as I understand SonarJS runs in a separate node runtime somewhere in Sonarqube and it only has access to dependencies listed under bundledDependencies, therefore it can’t resolve @tsconfig package as it’s not listed there.
However this is in contradiction with some tests that are already present like for example tsconfig_found, obviously tests pass because the dep is available in the monorepo when jest tests are running but in actual runtime that is not the case.

Can we add packages the most popular bases GitHub - tsconfig/bases: Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment to the bundled deps at least? I can create a pull request to add these, these are by far the most popular bases and most widely used.

Or is there some other way to make this available during sonarJS runtime that I am missing?

Hi @stefanoviv ,

this is on our radar, but we don’t have concrete plans yet and it likely won’t happen in short-term (perhaps Q2 or Q3, but no commitment here).

What can I advice, you can install the dependency yourself (ie invoke npm ci or similar) before the analysis

1 Like

@saberduck thank you for the quick reply.
I tried it out and having @tsconfig/ember in my node_modules before running the scan fixes the issue.

I actually thought this wouldn’t work because sonarjs runs in sonarqube in totally separate node runtime.
Out of curiosity do you know how this works, how does it have access to the node_modules in the code repository where the scan is being performed?

Are you somehow reading this from our node_modules and using create-ts-config route in the bridge server to save the file or am I missing something?

hi Vuk, analysis runs on the machine where you run the scanner, not on SonarQube. It will consider the dependencies available on local filesystem.

1 Like