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

Changing files in one entry triggers check in another webpack entry point #626

Closed
Melzmr opened this issue Jun 19, 2021 · 2 comments
Closed
Labels

Comments

@Melzmr
Copy link

Melzmr commented Jun 19, 2021

First of all thank you for working on this plugin and fixing this issue #558

However, I noticed another problem with the plugin v6+

Current behavior

Let's say we have 2 different entry points of webpack config.
firstEntry.ts – client bundle
secondEntry.ts – server bundle
And we run two parallel npm run watch scripts.
In case of changing something in firstEntry.ts file, checks are triggered in both watch scripts.

Expected behavior

Changing something in firstEntry.ts should only trigger TS check in this particular webpack entry.

P.S. In v.5.2.1 it works as it should. TS checker runs only for the changed entry point.

Steps to reproduce the issue

  1. Open two terminal windows
  2. Run npm run watch:first in first window
  3. Run npm run watch in second window
  4. Notice how change in firstEntry.ts file also triggered check in second terminal window (secondEntry.ts)

Issue reproduction repository

https://github.com/Melzmr/excluded-558

Environment

  • fork-ts-checker-webpack-plugin: ^6.2.12
  • typescript: ^4.2.4
  • eslint: none
  • webpack: ^5.36.2
  • os: MacOS 11.3

Now:

image

Before:

image

@Melzmr Melzmr added the bug label Jun 19, 2021
@piotr-oles
Copy link
Collaborator

piotr-oles commented Jun 19, 2021

It's an intentional behavior - the plug-in tries to mimic tsc as much as it's possible. The changes in v6 that triggers build on unrelated files changes from the webpack perspective fixes watch issues with type-only files. In previous versions if you had type-only file, it was not included in the dependencies set and therefore was not watched.
In general, the issue comes from the fact that TypeScript project have different semantics than webpack project and they are not compatible. The current solution favors TypeScript semantics where project is a set of files that matches pattern from tsconfig file (not dependency graph like in webpack)

@Melzmr
Copy link
Author

Melzmr commented Jun 19, 2021

@piotr-oles Oh, I see. Thanks for the explanation!

@Melzmr Melzmr closed this as completed Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants