webpack-contrib / cache-loader

[DEPRECATED] Caches the result of following loaders on disk
MIT License
637 stars 51 forks source link

Use relative path on this.fs.stat returns stale metadata #86

Open mistic opened 5 years ago

mistic commented 5 years ago

Expected Behavior

When using cache-loader configured with cacheContext under a webpack in watch and running a development configuration, it was expected to have the final bundles always in sync with the changed source files.

Actual Behavior

In the above mentioned cache-loader version when cacheContext is used some relative paths are being used when calling this.fs.stat. That call would sometimes return wrong stale metadata and the cache-loader would return the cached results for that file instead of the ones newly changed on disk.

How Do We Reproduce?

Just use the mentioned cache-loader version in a simple application configured with webpack in watch mode running a development configuration. Start changing the source files and you'll see that sometimes, despite having webpack running the compilation, the bundles are not updated correctly with the last changes on disk.

This is a bug fixed by https://github.com/webpack-contrib/cache-loader/pull/83 but we might want to further investigate the cause for this directly in webpack/webpack dependencies that's why I'm opening that issue.

/CC @evilebottnawi