Skip to content

include patterns need to specifiy .json extension in composite projects despite resolveJsonModule: trueΒ #55366

Closed
@eps1lon

Description

@eps1lon

πŸ”Ž Search Terms

include composite resolveJsonModule

Reopening of #25636 which doesn't seem to have fixed all problems reported in that issue

πŸ•— Version & Regression Information

This is the behavior in every version I tried (up until 4.1)

⏯ Playground Link

https://github.com/eps1lon/ts-references-json

πŸ’» Code

import data from "./data.json";

export default { data };
{
  "extends": "../tsconfig.base.json",
  "compilerOptions": {
    "composite": true
  },
  "include": ["./**/*"]
}

πŸ™ Actual behavior

$ tsc --build tsconfig.json
feature-two/index.ts:1:18 - error TS6307: File '/Users/sebastian.silbermann/ts-references-json/feature-two/data.json' is not listed within the file list of project '/Users/sebastian.silbermann/ts-references-json/feature-two/tsconfig.json'. Projects must list all files or use an 'include' pattern.

1 import data from "./data.json";
                   ~~~~~~~~~~~~~


Found 1 error.

Explicitly adding .json to include like #25636 (comment) suggested works also but is unintuitive since the extension is only required in composite projects.

πŸ™‚ Expected behavior

Compiles just fine without having to add another include pattern using .json.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions