Skip to content
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

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fileName' of undefined #1293

Merged
merged 4 commits into from May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## v9.1.2

* [Fix removed files handling in watch mode](https://github.com/TypeStrong/ts-loader/pull/1293) - thanks @gasnier

## v9.1.1

* [update CHANGELOG.md for 8.2.0 release](https://github.com/TypeStrong/ts-loader/pull/1291) - thanks @johnnyreilly
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "ts-loader",
"version": "9.1.1",
"version": "9.1.2",
"description": "TypeScript loader for webpack",
"main": "index.js",
"types": "dist",
Expand Down Expand Up @@ -101,4 +101,4 @@
"typescript": "*",
"webpack": "*"
}
}
}
6 changes: 4 additions & 2 deletions src/after-compile.ts
Expand Up @@ -170,7 +170,9 @@ function determineFilesToCheckForErrors(
).keys()) {
const fileToCheckForErrors =
files.get(fileName) || otherFiles.get(fileName);
addFileToCheckForErrors(fileName, fileToCheckForErrors!);
if (fileToCheckForErrors) {//file may have been removed
addFileToCheckForErrors(fileName, fileToCheckForErrors);
}
}
}
}
Expand All @@ -184,7 +186,7 @@ function determineFilesToCheckForErrors(
return filesToCheckForErrors;

function addFileToCheckForErrors(filePath: FilePathKey, file: TSFile) {
if (!isReferencedFile(instance, filePath)) {
if (file && !isReferencedFile(instance, filePath)) {
filesToCheckForErrors.set(filePath, file);
}
}
Expand Down