From 71c0654bce230e9639ab6cfd9f9f8cae252f2a06 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 6 Feb 2017 11:50:20 +0100 Subject: [PATCH] Fix for #3847 The problem: duplication of symlinked source files (npm linked sources) in CompilerHost's stats. The solution: resolve these paths before of all Gift of jdavidls --- packages/@ngtools/webpack/src/compiler_host.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/@ngtools/webpack/src/compiler_host.ts b/packages/@ngtools/webpack/src/compiler_host.ts index 546ce6f9909e..a081de257e5d 100644 --- a/packages/@ngtools/webpack/src/compiler_host.ts +++ b/packages/@ngtools/webpack/src/compiler_host.ts @@ -117,14 +117,18 @@ 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); } + // FIX symlink duplication in npm linked modules (#3875) + if (fs.existsSync(path)) { + path = fs.realpathSync(path); + } + return path; } - private _setFileContent(fileName: string, content: string) { this._files[fileName] = new VirtualFileStats(fileName, content);