-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix virtual file invalidation #12591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 👍
e6601c1
to
7bd5d3a
Compare
@@ -80,8 +87,13 @@ export class WebpackCompilerHost implements ts.CompilerHost { | |||
invalidate(fileName: string): void { | |||
const fullPath = this.resolve(fileName); | |||
|
|||
if (this._memoryHost.exists(fullPath)) { | |||
this._memoryHost.delete(fullPath); | |||
if (fullPath.endsWith('.ts')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to also check if it no longer exists on disk as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, and I think that's what (rightfully) causing that failure on test-large.
7bd5d3a
to
fbe4e30
Compare
this._sourceFileCache.delete(fullPath); | ||
|
||
try { | ||
const exists = this._syncHost.isFile(fullPath); | ||
if (exists) { | ||
this._changedFiles.add(fullPath); | ||
} | ||
} catch { } | ||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isFile
may or may not throw if the file exists. Some host do and some do not.
Maybe something similar to the following:
let exists = false;
try {
exists = this._syncHost.isFile(fullPath);
if (exists) {
this._changedFiles.add(fullPath);
}
} catch { }
// File doesn't exist anymore, so we should delete the related virtual files.
if (!exists && fullPath.endsWith('.ts')) {
this._virtualFileExtensions.forEach(ext => {
const virtualFile = (fullPath.slice(0, -3) + ext) as Path;
if (this._memoryHost.exists(virtualFile)) {
this._memoryHost.delete(virtualFile);
}
});
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
fbe4e30
to
d1b1602
Compare
d1b1602
to
afb5279
Compare
@filipesilva I think this also solves #12620? |
I'm not sure it's related. Have you tested it? |
@filipesilva I gave it a shot and cannot replicate. Will ask for repo. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Followup to #12588, should fix #12260 going forward.
Fix #9669
Fix #12657