Skip to content

Commit 71c0654

Browse files
author
bob
committed
Fix for angular#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
1 parent 73d5628 commit 71c0654

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/@ngtools/webpack/src/compiler_host.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,18 @@ export class WebpackCompilerHost implements ts.CompilerHost {
117117
private _resolve(path: string) {
118118
path = this._normalizePath(path);
119119
if (path[0] == '.') {
120-
return join(this.getCurrentDirectory(), path);
120+
path = join(this.getCurrentDirectory(), path);
121121
} else if (path[0] == '/' || path.match(/^\w:\//)) {
122-
return path;
122+
// return path;
123123
} else {
124-
return join(this._basePath, path);
124+
path = join(this._basePath, path);
125125
}
126+
// FIX symlink duplication in npm linked modules (#3875)
127+
if (fs.existsSync(path)) {
128+
path = fs.realpathSync(path);
129+
}
130+
return path;
126131
}
127-
128132
private _setFileContent(fileName: string, content: string) {
129133
this._files[fileName] = new VirtualFileStats(fileName, content);
130134

0 commit comments

Comments
 (0)