TypeScript Version: 2.3.2
Code
Project layout:
|__node_modules/
| |__foo/
| |__foo.js
|__src/
|__index.ts
tsonfig.json:
{
"compilerOptions": {
"allowJs": true,
"module": "es2015",
"moduleResolution": "node",
"outDir": "lib",
"rootDir": "src",
"target": "esnext"
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
], "exclude": [
"node_modules/**/*",
"third_party/**/*"
]
}
index.ts:
import * from '../node_modules/foo/foo.js';
Expected behavior:
Compilation works
Actual behavior:
error TS6059: File '/Users/justin/Documents/Projects/test/node_modules/foo/foo.js' is not under 'rootDir' '/Users/justin/Documents/Projects/test/src'. 'rootDir' is expected to contain all source files.
error
My lib/ directory, which should contain just the compiled contents of src/ contains src/ and node_modules/ subdirectories.
If I remove allowJs, then tsc complains that I'm importing JS and need to add the option.
TypeScript Version: 2.3.2
Code
Project layout:
tsonfig.json:
{ "compilerOptions": { "allowJs": true, "module": "es2015", "moduleResolution": "node", "outDir": "lib", "rootDir": "src", "target": "esnext" }, "include": [ "src/**/*.ts", "src/**/*.tsx" ], "exclude": [ "node_modules/**/*", "third_party/**/*" ] }index.ts:
Expected behavior:
Compilation works
Actual behavior:
error TS6059: File '/Users/justin/Documents/Projects/test/node_modules/foo/foo.js' is not under 'rootDir' '/Users/justin/Documents/Projects/test/src'. 'rootDir' is expected to contain all source files.
error
My
lib/directory, which should contain just the compiled contents ofsrc/containssrc/andnode_modules/subdirectories.If I remove
allowJs, then tsc complains that I'm importing JS and need to add the option.