Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit d05133c

Browse files
sis0k0Brocco
authored andcommitted
fix(@ngtools/webpack): resolve all file requests with the virtual fs
fixes #885
1 parent d715cc9 commit d05133c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/ngtools/webpack/src/compiler_host.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,11 @@ export class WebpackCompilerHost implements ts.CompilerHost {
232232
return stats.content;
233233
}
234234

235-
// Does not delegate, use with `fileExists/directoryExists()`.
236-
stat(path: string): VirtualStats {
235+
stat(path: string): VirtualStats | null {
237236
const p = this.resolve(path);
238237
const stats = this._files[p] || this._directories[p];
239238
if (!stats) {
240-
throw new Error(`File not found: ${JSON.stringify(p)}`);
239+
return this._syncHost.stat(p) as VirtualStats | null;
241240
}
242241

243242
return stats;

packages/ngtools/webpack/src/virtual_file_system_decorator.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
1818
private _webpackCompilerHost: WebpackCompilerHost,
1919
) { }
2020

21-
// We only need to intercept calls to individual files that are present in WebpackCompilerHost.
2221
private _readFileSync(path: string): string | null {
23-
if (this._webpackCompilerHost.fileExists(path, false)) {
22+
if (this._webpackCompilerHost.fileExists(path)) {
2423
return this._webpackCompilerHost.readFile(path) || null;
2524
}
2625

2726
return null;
2827
}
2928

3029
private _statSync(path: string): Stats | null {
31-
if (this._webpackCompilerHost.fileExists(path, false)) {
30+
if (this._webpackCompilerHost.fileExists(path)) {
3231
return this._webpackCompilerHost.stat(path);
3332
}
3433

0 commit comments

Comments
 (0)