Skip to content

tsc --watch is inconsistently reporting node_modules files as being outside rootDir #19327

Closed
@Jessidhia

Description

@Jessidhia

TypeScript Version: 2.6.0-rc

Code

With a directory layout like:

node_modules/
src/tsconfig.json
src/index.ts
package.json
import findCacheDir = require('find-cache-dir')

Expected behavior:

Compilation with no errors (other than findCacheDir not used if the option is enabled)

Actual behavior:

Intermittent error TS6059 whenever the file is edited. The error occasionally goes away or returns whenever a build is triggered by --watch.

If there are multiple files in the project almost all of them will produce errors for the things they are importing from node modules. But only sometimes 😕

error TS6059: File '.../node_modules/find-cache-dir/index.js' is not under 'rootDir' '.../src'. 'rootDir' is expected to contain all source files.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions