From 18b1e83c4e3e77d7ad7d04decda3c1f282e2b725 Mon Sep 17 00:00:00 2001 From: JDavid Luque Date: Fri, 6 Jan 2017 06:51:43 +0100 Subject: [PATCH] Update compiler_host.ts Fix for #3875 The problem: duplication of symlinked source files (npm linked sources) in CompilerHost's stats. The solution: resolve these paths before of all Gift of kings --- packages/@ngtools/webpack/src/compiler_host.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/@ngtools/webpack/src/compiler_host.ts b/packages/@ngtools/webpack/src/compiler_host.ts index b1ff333a8944..d08c5e5d033b 100644 --- a/packages/@ngtools/webpack/src/compiler_host.ts +++ b/packages/@ngtools/webpack/src/compiler_host.ts @@ -109,12 +109,15 @@ export class WebpackCompilerHost implements ts.CompilerHost { private _resolve(path: string) { path = this._normalizePath(path); if (path[0] == '.') { - return join(this.getCurrentDirectory(), path); + path = join(this.getCurrentDirectory(), path); } else if (path[0] == '/' || path.match(/^\w:\//)) { - return path; + //return path; } else { - return join(this._basePath, path); + path = join(this._basePath, path); } + if( fs.existsSync(path) ) // FIX symlink duplication in npm linked modules (#3875) + path = fs.realpathSync(path); + return path; } private _setFileContent(fileName: string, content: string) {