ts-loader should listen to file changes.
It seems that the file is still in cache somewhere, restarting webpack or renaming the file solves temporarily this problem but any file changes isn't committed in ts-loader.
Even if i change the interface properties or the interface name i cannot use my new values until i rename the file o restart webpack.
env:
Use any webpack config with watch: true.

https://github.com/monkeythedev/ts-loader-interface-watch-bug/tree/master
@monkeythedev if you'd like to submit a speculative PR to fix this I'll take a look
I'm also experiencing this behavior - adding a new interface to a file where _only interfaces and types are present_ doesn't actually allow me to use that interface/type anywhere else in my app. If that file contains at least one non-TypeScript thing (a variable, etc) it seems to work fine, and changes are saved properly across the app.
We see this the most in our types/ directory, where files will typically only contain interfaces/types and the changes have to be propagated via stopping and restarting Webpack Dev Server.
Versions: (I know these are a bit older, but we've been seeing this problem for some time now as well)
ts-loader: 5.3.0
webpack: 4.17.1
@monkeythedev if you'd like to submit a speculative PR to fix this I'll take a look
Idk... I debugged for a few hours and found that in after-compile at function provideErrorsToWebpack after calling ensureProgram the instance returned does have in the value returned by program.getSourceFiles() the old source of the interface files. It's like the watcher cannot listen for the changed source...
I tried awesome-typescript-loader and it work fine, but i can't figure out why....
I also tried with the option experimentalWatchApi: true since at-loader uses createWatchProgram to create the watcher, but i had no results.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing as stale. Please reopen if you'd like to work on this further.
Most helpful comment
I'm also experiencing this behavior - adding a new interface to a file where _only interfaces and types are present_ doesn't actually allow me to use that interface/type anywhere else in my app. If that file contains at least one non-TypeScript thing (a variable, etc) it seems to work fine, and changes are saved properly across the app.
We see this the most in our
types/directory, where files will typically only contain interfaces/types and the changes have to be propagated via stopping and restarting Webpack Dev Server.Versions: (I know these are a bit older, but we've been seeing this problem for some time now as well)
ts-loader: 5.3.0webpack: 4.17.1