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

Updating to v6.0.0 causes Webpack to go into a loop when watching for changes #527

Closed
rmuchall opened this issue Nov 7, 2020 · 12 comments · Fixed by #528 or #532
Closed

Updating to v6.0.0 causes Webpack to go into a loop when watching for changes #527

rmuchall opened this issue Nov 7, 2020 · 12 comments · Fixed by #528 or #532

Comments

@rmuchall
Copy link

rmuchall commented Nov 7, 2020

Current behavior

After updating to v6.0.0 of fork-ts-checker-webpack-plugin Webpack goes into an infinite loop where it rebuilds over and over.
This is while using webpack-dev-server to monitor for file changes.

Expected behavior

Webpack should build once only.

Steps to reproduce the issue

Apologies I am unable to provide a minimal repository for this issue. I am happy to try to provide any log/output/debugging information that may help trace the issue.

Environment

  • fork-ts-checker-webpack-plugin: [6.0.0]
  • typescript: [4.0.5]
  • eslint: [7.13.0]
  • webpack: [5.4.0]
  • os: [Windows 10 (latest)]

Further info

Attempting to use the following plugin to display a list of the modified files that were trigging the build was unfortunately unsuccessful. The plug simply reports an empty array (no modified files).
https://stackoverflow.com/a/64564708

@rmuchall rmuchall added the bug label Nov 7, 2020
@piotr-oles
Copy link
Collaborator

Please use logger: { infrastructure: 'console' } option in the plugin to see why it rebuilds :)

@rmuchall
Copy link
Author

rmuchall commented Nov 7, 2020

Many thanks for your swift response :)
Using your advice I can see that the issue is related to the parsing/transpilation of Vue components. This has allowed me to create a minimal repository to reproduce the issue. Thanks for your assistance!
https://github.com/rmuchall/forktschecker-test

@sureshjoshi
Copy link

sureshjoshi commented Nov 8, 2020

Not sure if this is helpful or distracting, but in my build (just ran into this problem about 20 minutes ago on Webpack 5.4, Yarn 2.3.3, Fork-TS 6.0.0) the recompilations are actually happening because of Yarn's virtual packages... Very strange, as I thought only my src directory was being watched - maybe this is the same problem for you?

Changed files: []
  Deleted files: ["project-dir/.yarn/$$virtual",
  "project-dir/.yarn/$$virtual/html-webpack-plugin-virtual-1f826e50b2",
  "project-dir/.yarn/$$virtual/webpack-dev-server-virtual-97193fef9b",
  "project-dir/.yarn/$$virtual/@hot-loader-react-dom-virtual-7925d62d0d",
  "project-dir/.yarn/$$virtual/webpack-virtual-20f557443a",
  "project-dir/.yarn/$$virtual/style-loader-virtual-fb24dccf6c",
  "project-dir/.yarn/$$virtual/css-loader-virtual-dd5d84c951",
  "project-dir/.yarn/$$virtual/postcss-loader-virtual-164291359e",
  "project-dir/.yarn/$$virtual/react-hot-loader-virtual-3a6aef74de",
  "project-dir/.yarn/$$virtual/react-table-virtual-6edbf85ecf",
  "project-dir/.yarn/$$virtual/html-webpack-plugin-virtual-1f826e50b2/0",
  "project-dir/.yarn/$$virtual/webpack-dev-server-virtual-97193fef9b/0",
  "project-dir/.yarn/$$virtual/@hot-loader-react-dom-virtual-7925d62d0d/0",
  "project-dir/.yarn/$$virtual/webpack-virtual-20f557443a/0",
  "project-dir/.yarn/$$virtual/style-loader-virtual-fb24dccf6c/0",
  "project-dir/.yarn/$$virtual/css-loader-virtual-dd5d84c951/0",
  "project-dir/.yarn/$$virtual/postcss-loader-virtual-164291359e/0",
  "project-dir/.yarn/$$virtual/react-hot-loader-virtual-3a6aef74de/0",
  "project-dir/.yarn/$$virtual/react-table-virtual-6edbf85ecf/0"]

Edit: Should also mention, my tsconfig is pointed at src only, and I've tried ignoring this directory in eslint, webpack, tsconfig - with no luck. I'm not entirely sure how to get fork-ts watcher to ignore files.

I should also mention that when I disable the fork-ts plugin, webpack doesn't re-compile loop. There is some strange interop happening.

@piotr-oles
Copy link
Collaborator

Thanks @rmuchall for the reproduction repository - I found the bug :)
@sureshjoshi Could you tell me which OS do you use? Is it Windows?

@sureshjoshi
Copy link

@piotr-oles

This is on MacOS 10.15.7

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 6.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@eamodio
Copy link
Contributor

eamodio commented Nov 10, 2020

FYI, I had the same issue, but I don't have any .vue files in my project. I tracked it down to using the clean-webpack-plugin (with some custom settings). These seemed to work ok with v5, but with v6 it caused this loop. Avoiding my custom clean settings (which I apparently no longer needed), it works fine with v6.

And with using the logger: { infrastructure: 'console' } option, it showed that the root dir of the project and its parent changed for some reason.

@piotr-oles
Copy link
Collaborator

@sureshjoshi Could you provide a reproduction repository?

@sureshjoshi
Copy link

@piotr-oles I'll try to create one, my project I'm using is private at the moment.

@sureshjoshi
Copy link

sureshjoshi commented Nov 11, 2020

@piotr-oles Okay, here it is... I tried to strip almost everything out that I could. I left in only what I thought is the minimal configuration to keep the repo as "real-world" as possible.

https://github.com/sureshjoshi/fork-ts-checker-reload-bug

Please note, I use yarn 2.3.3 - I just tried npm install and it didn't even work due to a resolution fight with webpack-dev-server and webpack 5... That might be related, but yarn seems to work.

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 6.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sureshjoshi
Copy link

Confirmed 6.0.2 fixes the recursive build problem on my example repo and in my private repo.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants