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

Watcher gets an instance of IgnoringWatchFileSystem and errors #441

Closed
herschel666 opened this issue Jan 13, 2017 · 7 comments
Closed

Watcher gets an instance of IgnoringWatchFileSystem and errors #441

herschel666 opened this issue Jan 13, 2017 · 7 comments
Labels

Comments

@herschel666
Copy link
Contributor

herschel666 commented Jan 13, 2017

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! :-)

@scriby
Copy link

scriby commented Jan 19, 2017

I ran into the exact same issue.

@johnnyreilly
Copy link
Member

Could a minimal repro be supplied please? We can use this as a basis for a comparison test which is necessary for this PR to remedy the issue: #444

@herschel666
Copy link
Contributor Author

I'm currently setting up the comparison test. Still wrangling with the webpack output though …

@johnnyreilly
Copy link
Member

Believe me I know that feeling... Do take a look at the existing tests - due to webpack 2 they've all changed in some way. Oh and ignore test output for pre TypeScript 2.1. it's for historic Interest only

@johnnyreilly
Copy link
Member

johnnyreilly pushed a commit that referenced this issue Jan 20, 2017
* Add support for IgnoringWatchFileSystem-instance in watcher

* Add comparison test concerning #441
@stale
Copy link

stale bot commented Jan 19, 2019

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.

@stale stale bot added the wontfix label Jan 19, 2019
@stale
Copy link

stale bot commented Jan 26, 2019

Closing as stale. Please reopen if you'd like to work on this further.

@stale stale bot closed this as completed Jan 26, 2019
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

3 participants