In my Webpack-setup I'm ignoring some .d.ts-files by adding Webpack's WatchIgnorePlugin-plugin. These ignored files lead to the watchFileSystem of the webpack-compiler not being an instance of NodeWatchFileSystem, but of IgnoringWatchFileSystem.
This again makes src/watch-run.ts throw an error, because it expects the watcher-property to be on watching.compiler.watchFileSystem. But instances of the IgnoringWatchFileSystem have their instance of NodeWatchFileSystem on the wfs-property.
node_modules/ts-loader/dist/watch-run.js:10
var mtimes = watching.compiler.watchFileSystem.watcher.mtimes;
^
TypeError: Cannot read property 'mtimes' of undefined
This can easily be fixed by doing:
function makeWatchRun(
instance: interfaces.TSInstance
) {
return (watching: interfaces.WebpackWatching, cb: () => void) => {
const watcher = watching.compiler.watchFileSystem.watcher ||
watching.compiler.watchFileSystem.wfs.watcher;
…
However I'm not sure if this is actually a problem of the ts-loader. Maybe .ts-files handled by the WatchIgnorePlugin-plugin must not run through the ts-loader at all?!?
Can someone with more knowledge of the internals of Webpack provide an oppinion? This would be great! :-)
In my Webpack-setup I'm ignoring some
.d.ts-files by adding Webpack'sWatchIgnorePlugin-plugin. These ignored files lead to thewatchFileSystemof the webpack-compiler not being an instance ofNodeWatchFileSystem, but ofIgnoringWatchFileSystem.This again makes
src/watch-run.tsthrow an error, because it expects thewatcher-property to be onwatching.compiler.watchFileSystem. But instances of theIgnoringWatchFileSystemhave their instance ofNodeWatchFileSystemon thewfs-property.node_modules/ts-loader/dist/watch-run.js:10 var mtimes = watching.compiler.watchFileSystem.watcher.mtimes; ^ TypeError: Cannot read property 'mtimes' of undefinedThis can easily be fixed by doing:
However I'm not sure if this is actually a problem of the
ts-loader. Maybe.ts-files handled by theWatchIgnorePlugin-plugin must not run through thets-loaderat all?!?Can someone with more knowledge of the internals of Webpack provide an oppinion? This would be great! :-)