cache-loader icon indicating copy to clipboard operation
cache-loader copied to clipboard

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

Open mistic opened this issue 6 years ago • 0 comments

  • Operating System: macOS 10.14.5
  • Node Version: 10.15.2
  • NPM Version: 6.9.0
  • webpack Version: 4.23.1
  • cache-loader Version: 4.0.0

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

mistic avatar Jun 25 '19 19:06 mistic