Skip to content

Commit

Permalink
perf: fix directory watchers to not invoke them unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-oles committed Jun 10, 2020
1 parent d1a0f18 commit 9041f53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/hooks/tapAfterCompileToGetIssues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import webpack from 'webpack';
import path from 'path';
import { ForkTsCheckerWebpackPluginConfiguration } from '../ForkTsCheckerWebpackPluginConfiguration';
import { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
import { getForkTsCheckerWebpackPluginHooks } from './pluginHooks';
Expand Down Expand Up @@ -35,7 +36,7 @@ function tapAfterCompileToGetIssues(
if (configuration.issue.scope === 'webpack') {
// exclude issues that are related to files outside webpack compilation
issues = issues.filter(
(issue) => !issue.file || compilation.fileDependencies.has(issue.file)
(issue) => !issue.file || compilation.fileDependencies.has(path.normalize(issue.file))
);
}

Expand Down
5 changes: 3 additions & 2 deletions src/hooks/tapDoneToAsyncGetIssues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import webpack from 'webpack';
import chalk from 'chalk';
import path from 'path';
import { ForkTsCheckerWebpackPluginConfiguration } from '../ForkTsCheckerWebpackPluginConfiguration';
import { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
import { getForkTsCheckerWebpackPluginHooks } from './pluginHooks';
Expand All @@ -7,7 +9,6 @@ import { Issue } from '../issue';
import { IssueWebpackError } from '../issue/IssueWebpackError';
import isPending from '../utils/async/isPending';
import wait from '../utils/async/wait';
import chalk from 'chalk';

function tapDoneToAsyncGetIssues(
compiler: webpack.Compiler,
Expand Down Expand Up @@ -53,7 +54,7 @@ function tapDoneToAsyncGetIssues(
if (configuration.issue.scope === 'webpack') {
// exclude issues that are related to files outside webpack compilation
issues = issues.filter(
(issue) => !issue.file || stats.compilation.fileDependencies.has(issue.file)
(issue) => !issue.file || stats.compilation.fileDependencies.has(path.normalize(issue.file))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function createControlledTypeScriptSystem(
invokeFileChanged(path: string) {
const normalizedPath = realFileSystem.normalizePath(path);

if (deletedFiles.get(normalizedPath) || !fileWatchersMap.has(path)) {
if (deletedFiles.get(normalizedPath) || !fileWatchersMap.has(normalizedPath)) {
invokeFileWatchers(path, ts.FileWatcherEventKind.Created);
invokeDirectoryWatchers(normalizedPath);

Expand Down

0 comments on commit 9041f53

Please sign in to comment.