You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using fork-ts-checker-webpack-plugin to run TypeScript checks in watch mode.
This plugin starts TypeScript in watch mode in a separate process. It needs to know, when user stops the webpack's watcher to be able to stop TypeScript service. So, it is listening to watchClose hook.
The problem is, that type-check can easily took 5-6 seconds for the first run and less than 200ms after recompilation. However, this stop/start behavior causes that it always starts from scratch.
So, my question is: Are we able to avoid stoping the watcher? I'm pretty sure that other webpack plugins can depend on it too. Also, fork-ts-checker-webpack-plugin is basically a standard for TS projects.
EDIT:
Another issue is that sometimes recompilation occurs twice:
@deftomat we are not using fork-ts-checker-webpack-plugin, but with Webpack 4 and ts-loader rebuild is triggered twice for me each time I change something.
@mochja@deftomat rebuild also triggered twice on my project. One thing i notice is that this line on wpwatch.js is never true
if (stats && stats.hash === lastHash) {
stats.hash and lastHash is always different. On a normal working project where this problem does not occur, that expression should be evaluated to true and acts as a terminal point of our watcher while it is waiting for the next changes.
On a troubled project however, it is as if there is another source of changes triggering the another new process which i'm still looking for.
@mochja Awesome! I'm actually okay with the current situation(rebuild triggered twice) as my current build process is still less than <10s but as my project grows in size i'll keep looking for the solution and might resort to your suggestion or @deftomat fork of this repo as a last resort. Thanks!
Activity
mochja commentedon Feb 20, 2019
@deftomat we are not using
fork-ts-checker-webpack-plugin, but with Webpack 4 and ts-loader rebuild is triggered twice for me each time I change something.did you happen to find solution for that?
mochja commentedon Feb 20, 2019
I think this is related to webpack/webpack#4991.
serverless-webpack/lib/wpwatch.js
Line 37 in ffc70bc
compiler.watchis triggering build first and then it's waiting for changes. So each timestartWatchis exectuted, build it triggered first.deftomat commentedon Feb 21, 2019
@mochja Hi, we are using a custom fork as it looks like the project is not maintained anymore.
This is a commit which fixed it for us: deftomat@839d2e5
livingmine commentedon Mar 23, 2019
@mochja @deftomat rebuild also triggered twice on my project. One thing i notice is that this line on wpwatch.js is never true
stats.hashandlastHashis always different. On a normal working project where this problem does not occur, that expression should be evaluated to true and acts as a terminal point of our watcher while it is waiting for the next changes.On a troubled project however, it is as if there is another source of changes triggering the another new process which i'm still looking for.
mochja commentedon Mar 23, 2019
We have stopped using webpack for development and instead use ts directly.
I did spend some time in debugger and there was no additional trigger in our case.
livingmine commentedon Mar 23, 2019
@mochja Awesome! I'm actually okay with the current situation(rebuild triggered twice) as my current build process is still less than <10s but as my project grows in size i'll keep looking for the solution and might resort to your suggestion or @deftomat fork of this repo as a last resort. Thanks!
HyperBrain commentedon Apr 30, 2019
Released with 5.3.0