-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
TypeScript Version: 2.0.3
OS: windows 10 x64
node: 6.3.1
Code
Project file structure:
- index.ts
- tsconfig.json
- src/foo.ts
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"outDir": "./dist",
"rootDir": ".",
"sourceMap": false,
"listFiles": true,
"traceResolution": true
},
"files": [
"index.ts"
]
}
index.ts
export * from './src/foo';
src/foo.ts
export class foo { }
Expected behavior:
I have mapped a virtual drive W: -> D:\projects\
using Vsubst. When compiling in version 1.8.10 it works fine. tsc with "listFiles": true
shows the following:
Using typescript 1.8.10
W:\tsc-test>tsc
C:/Users/xxxxx/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts
W:/tsc-test/src/foo.ts
index.ts
Actual behavior:
Version 2.0.3 throws error TS5009: Cannot find the common subdirectory path for the input files
. Running tsc with "listFiles" and "traceResolution" set to true reveals the problem:
Using typescript 2.0.3
W:\tsc-test>tsc
======== Resolving module './src/foo' from 'W:/tsc-test/index.ts'. ========
Module resolution kind is not specified, using 'NodeJs'.
Loading module as file / folder, candidate module location 'W:/tsc-test/src/foo'.
File 'W:/tsc-test/src/foo.ts' exist - use it as a name resolution result.
Resolving real path for 'W:/tsc-test/src/foo.ts', result 'D:/projects/tsc-test/src/foo.ts'
======== Module name './src/foo' was successfully resolved to 'D:/projects/tsc-test/src/foo.ts'. ========
error TS5009: Cannot find the common subdirectory path for the input files.
error TS6059: File 'D:/projects/tsc-test/src/foo.ts' is not under 'rootDir' 'W:/tsc-test'. 'rootDir' is expected to contain all source files.
C:/Users/xxxxx/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts
D:/projects/tsc-test/src/foo.ts
W:/tsc-test/index.ts
The same applies to "include" array and probably to "exclude" also.
UPDATE: Setting "moduleResolution": "classic"
in "compilerOptions"
resolves paths correcty but it obviously cannot resolve node_modules
dependencies like "moduleResolution": "node"
does, so it isn't a solution.
Using typescript 2.0.3
W:\tsc-test>tsc
======== Resolving module './src/foo' from 'W:/tsc-test/index.ts'. ========
Explicitly specified module resolution kind: 'Classic'.
File 'W:/tsc-test/src/foo.ts' exist - use it as a name resolution result.
======== Module name './src/foo' was successfully resolved to 'W:/tsc-test/src/foo.ts'. ========
======== Resolving module '@angular/core' from 'W:/tsc-test/src/foo.ts'. ========
Explicitly specified module resolution kind: 'Classic'.
File 'W:/tsc-test/src/@angular/core.ts' does not exist.
File 'W:/tsc-test/src/@angular/core.d.ts' does not exist.
File 'W:/tsc-test/@angular/core.ts' does not exist.
File 'W:/tsc-test/@angular/core.d.ts' does not exist.
File 'W:/@angular/core.ts' does not exist.
File 'W:/@angular/core.d.ts' does not exist.
======== Module name '@angular/core' was not resolved. ========
src/foo.ts(1,27): error TS2307: Cannot find module '@angular/core'.
C:/Users/xxxxx/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts
W:/tsc-test/src/foo.ts
W:/tsc-test/index.ts